Path to mathematics-sas memo (17), path to mathematics-sas memo 17

Source: Internet
Author: User

Path to mathematics-sas memo (17), path to mathematics-sas memo 17
SAS Date and Time Format
Data _ null _;
Input mydate YYMMDD10 .;
Put mydate YYMMDDB10 .;
Put mydate YYMMDDC10 .;
Put mydate YYMMDDD10 .;
Put mydate YYMMDDN8 .;
Put mydate YYMMDDP10 .;
Put mydate YYMMDDS10 .;
Cards;
2014-05-
;
Run;
All content of this blog is original, if reproduced please indicate the source http://blog.csdn.net/myhaspl/
2014 05 18

2014-05-18
20140518
2014.05.18

NOTE: time used by the "DATA statement" (total processing time ):
Actual Time: 0.03 seconds
CPU time: 0.01 seconds
Short Date Format: data _ null _;
Input mydate YYMMDD10 .;
Put mydate YYMMDDB8 .;
Put mydate YYMMDDC8 .;
Put mydate YYMMDDD8 .;
Put mydate YYMMDDN7 .;
Put mydate YYMMDDP8 .;
Put mydate YYMMDDS8 .;
Cards;
2014-05-18
;
Run;

14 05 18
14:05:18
14-05-18
140518
14.05.18
14/05/18
NOTE: time used by the "DATA statement" (total processing time ):
Actual Time: 0.00 seconds
CPU time: 0.00 seconds
Writes SAS date values in the form <yy> yymmdd or <yy> yy-mm-dd, where the x in the format name is a character that represents the special character that separates the year, month, and day. the special character can be a hyphen (-), period (.), blank character, slash (/), colon (:), or no separator; the year can be either 2 or 4 digits.

Syntax




YYMMDDxw.






Arguments




X




Identifies a separator or specifies that no separator appear between the year, the month, and the day. Here are the valid values:




B




Separates with a blank




C




Separates with a colon




D




Separates with a hyphen




N




Indicates no separator




P




Separates with a period




S




Separates with a slash.




W




Specifies the width of the output field.






Default


8






Range


2-10






Interactions


When w has a value of from 2 to 5, the date appears with as much of the year and the month. when w is 7, the date appears as a two-digit year without separators.






When x has a value of N, the width range is 2-8.






Details




The YYMMDDxw. format writes SAS date values in the form <yy> yymmdd or <yy> yyXmmXdd. Here is an explanation of the syntax:




<Yy> yy




Is a two-digit or four-digit integer that represents the year.




X




Is a specified separator.




Mm




Is an integer that represents the month.




Dd




Is an integer that represents the day of the month.




Comparisons







The YYMMDDw. d format is similar to the YYMMDDxw. d format, but YYMMDDxw. d format contains a separator between the year and month, such as a colon, slash, or period.






Example




The following examples use the input value of 18922, which is the SAS date value that corresponds to October 22,201 1.










Statements




Results








 


---- + ---- 1 ---- +






A = put (18922, yymmddc5 .);


11: 10






A = put (18922, yymmddd8 .);


11-10-22






A = put (18922, yymmddn8 .);


20111022






A = put (18922, yymmddp10 .);


2011.10.22
All content of this blog is original, if reproduced please indicate the source http://blog.csdn.net/myhaspl/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.