top of page
Writer's pictureEkta Aggarwal

YEARCUTOFF option in dates

Firstly let us initialize our library:

libname mylib '/home/u52453927/My_datasets';

To understand the YEARCUTOFF, let us define a dataset with dates 20Jan2017 , 20 Feb 2027 and 15 Aug 1988.

DATA mylib.mydata;
INPUT Date1 date7.;
FORMAT Date1 date9.;
CARDS;
20Jan17
20Feb27
15Aug88
;
RUN;

Notice the second date!










Instead of 2027 SAS took 1927. Why?

This is because of the year cutoff which SAS has by default. So let us try to understand what is this yearcutoff?


By default SAS currently has a yearcutoff of 1926 which means if you specify two-digits in a year as 26 - 99 then SAS will understand it as 1926 - 1999 and for 00 - 25 it will understand it as 2000 - 2025.

Thus when you defined 20Feb27 as your date, SAS understood it as 20 Feb 1927.


Is there any way to change this cutoff?

Yes. SAS provides us an option to set this year cutoff. For eg. to change the yearcutoff to 1950, I shall write:

options yearcutoff=1950;

Now we will rerun the above code chunk with redefining our yearcutoff!

options yearcutoff=1950;

DATA mylib.mydata;
INPUT Date1 date7.;
FORMAT Date1 date9.;
CARDS;
20Jan17
20Feb27
15Aug88
;
RUN;






Comments


bottom of page