The YEARCUTOFF= option lets you specify what century SAS should assign to dates when two-digit years are used.
The default year cutoff is 1926. However, you can set the yearcutoff option as below.
options yearcutoff=1920
You can specify the option in an Autoexec or config file. If the default value – 1920 is in effect, the 100-year span begins with 1920 and ends in 2019. Therefore, any informat or function that uses a two-digit year value assumes a prefix of 19.
For example, the value 88 refers to the year 1988.
How to see the Yearcutoff value set in your SAS session?
You can use the PROC OPTIONS procedure to see the system options in SAS Log. For example, you can specify yearcutoff in the option= to see only the value for yearcutoff.
proc options option=yearcutoff;
run;
After running the above code, the following message is displayed in the SAS log.
YEARCUTOFF=1926 Specifies the first year of 100 years used by the date informats and functions to read a two-digit year.
How does the YEARCUTOFF= option work?
The YEARCUTOFF= option specifies the first year of a 100-year window in which all 2-digit years are assumed to be. For example, if the YEARCUTOFF= option is set to 1926, all 2-digit years are considered from 1926 through 2026.
This means that two-digit years from 26-99 will be assigned a century prefix of ’19’, and all 2-digit years from 00-25 will have a century prefix of ’20’. Note that the year 2026 is exclusive.
Example:
data two;
input dt2 monyy7.;
format dt2 monyy7.;
datalines;
APR96
APR20
APR2020
APR25
APR26
APR27
APR2027
;
run;
As you can see, for APR26 and APR27, SAS has considered 1926 and 1927, but what was expected was 2026 and 2027. This is because 26 and 27 falls in the range of 26 to 99, which is the assigned year prefix of 19. Also, note that four-digit year values are not affected by the yearcutoff option.
You will expect the expected result if you update the yearcutoff value below.
options yearcutoff=1930
The YEARCUTOFF= option affects the interpretation of two-digit years in the following cases:
- When reading data values from external files.
- If you specify dates or year values in SAS functions.
- If you are specifying SAS date literal
The YEARCUTOFF= option does not affect the following cases:
- Suppose you are processing dates with 4-digit years—for example, 2004.
- If you are Processing dates already stored as SAS date values in numeric. (Example, the number of days since January 1, 1960)
- When displaying dates with SAS date formats.
We hope this article helped you to understand the yearcutoff option in SAS.
You may also want to see our articles on SAS Date Formats: How To Display Dates Correctly? and Date Functions In SAS – The Definitive Guide.