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. You can specify yearcutoff option as below.
You can also specify the option in an Autoexec file or a config file.
If the default value – 1920 is in effect, the 100-year span begins with 1920 and ends with 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?
PROC OPTIONS procedure can be used to see the system options in SAS Log. 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 a 100-year span that is used by 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 assumed to be in the period 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.
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, the SAS has considered 1926 and 1927, but what was expected was 2026 and 2027. This is because the 26 and 27 falls in the range of 26 to 99 which is assigned year prefix of 19. Also, note that 4 digit year values are not being affected by the yearcutoff option.
If you update the yearcutoff value as below, you will get the result as expected.
The YEARCUTOFF= option affects the interpretation of two-digit years in the following cases:
- When reading date values from external files.
- If you specifying dates or year values in SAS functions.
- If you are specifying SAS date literals
The YEARCUTOFF= option does not affect the following cases:
- If you are processing dates with 4-digit years. Example of 2004.
- If you are Processing dates that are 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 hoped this article helped you to understand the yearcutoff option in SAS.