SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 65647: Set up a rolling YEARCUTOFF option value

DetailsCodeAboutRate It

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.

Background

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:

  • Reading date values from external files
  • Specifying dates or year values in SAS functions
  • Specifying SAS date literals

The YEARCUTOFF= option has no effect in the following cases:

  • Processing dates with four-digit years
  • Processing dates already stored as SAS date values (the number of days since January 1, 1960)
  • Displaying dates with SAS date formats

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."

Workaround

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.

On the Full Code tab, you can access a sample macro called 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:

  • Modify your SITE CONFIG to use the INITSTMT. Here is an example:
INITSTMT='%INC "location.where.rollyco.stored";' 
  • Modify your SITE CONFIG to use the AUTOEXEC. For example:
AUTOEXEC='location.where.rollyco.stored'
  • Have each program run this macro as the first thing it does. For example:
%INC 'location.where.rollyco.stored';         

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)



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASz/OS
z/OS 64-bit
OpenVMS VAX
Macintosh
Microsoft® Windows® for 64-Bit Itanium-based Systems
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows XP 64-bit Edition
Microsoft® Windows® for x64
OS/2
Microsoft Windows 8 Enterprise 32-bit
Microsoft Windows 8 Enterprise x64
Microsoft Windows 8 Pro 32-bit
Microsoft Windows 8 Pro x64
Microsoft Windows 8.1 Enterprise 32-bit
Microsoft Windows 8.1 Enterprise x64
Microsoft Windows 8.1 Pro 32-bit
Microsoft Windows 8.1 Pro x64
Microsoft Windows 10
Microsoft Windows 95/98
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Server
Microsoft Windows 2000 Professional
Microsoft Windows NT Workstation
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2008
Microsoft Windows Server 2008 R2
Microsoft Windows Server 2008 for x64
Microsoft Windows Server 2012 Datacenter
Microsoft Windows Server 2012 R2 Datacenter
Microsoft Windows Server 2012 R2 Std
Microsoft Windows Server 2012 Std
Microsoft Windows Server 2016
Microsoft Windows Server 2019
Microsoft Windows XP Professional
Windows 7 Enterprise 32 bit
Windows 7 Enterprise x64
Windows 7 Home Premium 32 bit
Windows 7 Home Premium x64
Windows 7 Professional 32 bit
Windows 7 Professional x64
Windows 7 Ultimate 32 bit
Windows 7 Ultimate x64
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.