Cornell University Cornell University CISER

CISER Computing

Working with Dates where Years are in Two Digit Format

Q.  Dates in my data have only two digits to represent a year. The digits 00 represent the year 2000, but my SAS program interprets this as 1900. What can I do about this?

A.  Use the SAS system option "YEARCUTOFF=" to specify the first year of a 100 year span within which you want your 2-digit dates to fall.   For example:

options yearcutoff=1950;

would interpret the 2-digit year values 50-99 as 1950 to 1999 and values 00-49 as being 2000 to 2049.

For SAS Versions 6.04 -  6.12 the system default value is YEARCUTOFF= 1900.  This means that all two digit years will be assumed to be between 1900 and 1999, unless you reset the default.

For SAS Version 7.0 -- 8.1  the system default is YEARCUTOFF=1920.  This means that all two digit years will be assumed to be between 1920 and 2019, unless you reset the default.

The default value for either version can be easily reset by using the "YEARCUTOFF=" option as shown above.

To find out whether the YEARCUTOFF option has been reset on any version of SAS that you are using you can submit these statements:

proc options option=yearcutoff;
run;

OR -- from SAS 8.1 for Windows just go to Tools --> Options --> System --> Input Control --> Data Processing.  Then scroll down through the list of options until you see Yearcutoff...



RELATED INFORMATION: SAS maintains dates internally as the number of days since January 1, 1960, so there is no problem internally with dates in the year 2000 and after.  For information about working with dates in SAS (including information about how to use  date "informats" for reading dates from raw data files, as well as "formats" for reporting dates, etc) see "SAS Language and Procedures, Usage, Version 6, Chapter 13 - Working with Dates in the SAS System" or refer to the online help in your SAS Software or SAS Online Documentation CD.