Path to mathematics-sas memo (14), path to sas memo 14
Sas Date Format
Data _ null _;
X = '7jan2012 'd;
Put x yymm7 .;
Put x yymmc7 .;
Put x yymmd7 .;
Put x yymmn6 .;
Put x yymmp 7 .;
Put x yymms7 .;
Put x yymon7 .;
Put x mmddyy10 .;
Put x yymmdd10 .;
Run;
All content of this blog is original, if reproduced please indicate the source http://blog.csdn.net/myhaspl/2012M01
2012-01
201201
2012.01
2012/01
2012JAN
01/07/2012
2012-01-07
In SAS, a value is used to represent a date. The SAS date value is equal to the number of days since January 1.
For example:
Date SAS value
1959-1-1-365
1960-1-1 0
1961-1-1 365
2008-1-1 17532
Date input and output formats
Data x12;
Input date1: yymmdd10. date2: yymmdd10 .;
Format date1: yymmdd10. date2: yymmdd10 .;
Days1 = datdif (date1, date2, 'Act/act ');/* Actual */
Days2 = datdif (date1, date2, '000000');/* 30 days per month */
Datalines;
;
Proc print;
Run;
Data x110;
Input date1: anydtdte. date2: anydtdte .;
Format date1: yymmdd10. date2: yymmdd10 .;
Days1 = datdif (date1, date2, 'Act/act ');/* Actual */
Days2 = datdif (date1, date2, '000000');/* 30 days per month */
Datalines;
2015-01-0
;
Proc print;
Title "anydtdte ";
Run;
Labels and Formats Window
Use the Labels and Formats window to specify labels, widths, and formats for displaying variables in the application. The window contains the following items:
Variable |
Lists the variables for which you can customize labels and formats. This includes des analysis and drill variables. You can add or delete variables by going to the corresponding variable selection windows. |
Type |
Lists the data type for the corresponding variable, as specified in the data set.
N |
Stands for numeric. |
C |
Stands for character. |
|
Default |
Type any character other than blank into the field. that value is converted to X. when the Default flag is set, values for labels and formats are read from the repository at run time. if the flag is not set, values specified here are used. |
Label |
Enter a label up to 30 characters long for each variable. Default labels are taken from the repository. If the Default flag is set, the labels are taken directly from the repository at run time. |
Format |
Enter a format for displaying the variable's values in the report. The format type must match the variable type as shown in the Variable column. The field is initialized with the format from the repository. You can enter a question mark (?) As the first character in the field to display a list of valid formats. If the Default flag is set, the formats are taken directly from the repository at run time. |
Width |
Specifies a column width for displaying values of the corresponding variable in the report. The default width is determined by analyzing the current format. if that is not possible (for example, for user-written character formats), the length of the variable is used. field width must not be smaller than the width of the formatted values, but it can be larger, for example, to create room for long labels. |
Reset |
Returns all values to the default values specified in the repository. |