In SAS® 9.3 and earlier, the default value of the YEARCUTOFF= option is 1920. This default setting causes data integrity issues because any two-digit years of "20" in dates will be assumed to be 1920 instead of 2020. If the intended year in the date is 2020, you must set the YEARCUTOFF= option to a value larger than 1920. The best alternative is to always specify four-digit years in dates to avoid confusion.
The YEARCUTOFF= system option lets you specify which century SAS software should assign to dates with two-digit years used in SAS programs and input data. The YEARCUTOFF= option specifies the first year of a 100-year window in which all two-digit years are assumed to occur. For example, if the YEARCUTOFF= option is set to 1920, which is the default for SAS 9.3 and earlier, all two-digit years are assumed to occur between 1920 and 2019. This behavior means that two-digit years from 20 to 99 will be assigned a century prefix of "19," and all two-digit years from 00 to 19 will have a century prefix of "20."
The YEARCUTOFF= option affects the interpretation of two-digit years in the following cases:
The YEARCUTOFF= option has no effect in the following cases:
For more information, see SAS Note 65307, "You might encounter an issue in which two-digit year dates have the wrong century in SAS® 9.3 and earlier releases."
This SAS Note provides an example that enables SAS customers to set the SAS system option YEARCUTOFF with a rolling value to mitigate the necessity of managing the site setting for this option every year.
Here is a macro that you can use to set a rolling YEARCUTOFF value:
%MACRO ROLLYCO(OFFSET=99);
data _null_;
call symput('yearcutoff',put(year(date())-&OFFSET,4.)||';');
run;
options YEARCUTOFF=&yearcutoff;
%MEND ROLLYCO;
%ROLLYCO;
As provided, this macro sets the SAS system option YEARCUTOFF to the current four-digit year minus 99. For example, if the current year is 2020, then the SAS system option YEARCUTOFF is set to 1921. To adjust the rolling date to a different default for your site, change the value for the OFFSET= used in the MACRO.
In order to always use this macro in your SAS software, use one of the following methods and see the note below the methods:
Note: This is the least favored option.
Note for all methods: The placeholder location.where.rollyco.stored is the path and name for the stored sample program that provides Read permissions for all.
Examples of locations:
Windows: c:\public\sasmac\rollyco.txt
UNIX: /usr/lpp/SAS/sasmac/rollyco
z/OS: PUBLIC.PDS.SASMAC(ROLLYCO)