The YEARCUTOFF= system option specifies the first year of the 100-year span that is used to determine the century of a two-digit year.
Before you use the YEARCUTOFF= system option, examine the dates in your data:
- If the dates in your data fall within a 100-year span, you can use the YEARCUTOFF= system option.
- If the dates in your data do not fall within a 100-year span, you must either convert the two-digit years to to four-digit years or use a DATA step with conditional logic to assign the proper century prefix.
- SAS interprets all two-digit dates in the range of 20 through 99 as 1920 through 1999.
- SAS interprets all two-digit dates in the range 00 through 19 as 2000 through 2019.
proc options option=yearcutoff;
run;
You will see something like this(date may be different) as response in SAS Log:
YEARCUTOFF=1920 Cutoff year for DATE and DATETIME informats and functions
Example:
Before changing default value:
Code:
data yearTest;
date='01jan20'd;
put 'Date= ' date date9.;
run;
Response in log:
Date=01JAN1920
After changing default value:
Code:
options yearcutoff = 1950;
data yearTest;
date='01jan20'd;
put 'Date= ' date date9.;
run;
Response in log:
Date=01JAN2020
Your system administrator may change the default to suit specific needs at your work site.
No comments:
Post a Comment