|
A Guide to the YEARCUTOFF= Option (Note: this document revises/replaces TS-597.)THIS IS A YEAR 2000 READINESS DISCLOSUREThe YEARCUTOFF= option is used by SAS software to assign a century prefix to two digit years used in SAS programs and input data. In order to make your SAS applications Year 2000 compliant, it is important to understand and correctly use the YEARCUTOFF= option. The following questions and answers provide detailed information on the usage of the option. What is the YEARCUTOFF= option and how does it work?Q: What is the YEARCUTOFF= option? A: The YEARCUTOFF= option lets you specify what century SAS software should assign to dates with two-digit years. Q: How do I specify the YEARCUTOFF= option in my SAS programs? A: The option is specified in an OPTIONS statement--for
example:
Q: How does the YEARCUTOFF= option work? A: 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 1920, all 2 digit years are assumed to be in the period 1920 through 2019. This means that two-digit years from 20-99 will be assigned a century prefix of '19' and all 2 digit years from 00-19 will have a century prefix of '20'. Q: What types of date values are, and are not, affected by the YEARCUTOFF= option? A: The YEARCUTOFF= option affects the interpretation of two digit years in the following cases:
The YEARCUTOFF= option has no effect in the following cases:
Here are some specific examples. Assume that YEARCUTOFF=1930 has been specified:
Q: What value should I set the YEARCUTOFF= option to? A: The optimal value depends on the range of dates in your data. The YEARCUTOFF= option should be set so that the 100 year range that it covers encompasses the range of your data. In general, we recommend setting the YEARCUTOFF= option to a value equal to or slightly less than the first year in your data. For example, if the range of dates you are processing is from 1930-2010, a YEARCUTOFF value of 1925 or 1930 would be appropriate. If you set YEARCUTOFF=1925, then all two-digit years are assumed to be in the 100 year period from 1925 to 2024, and if all of the dates in your data fall within that range, they will be interpreted correctly. Q: Should I reset the YEARCUTOFF= option to 2000 on January 1, 2000? A: No. By setting the YEARCUTOFF= option to 2000, all dates with two-digit years would be interpreted as being in between 2000 and 2099. This means that a date such as 01MAR98 would be assumed to be March 1, 2098. Unless you want all two-digit years interpreted as being between 2000 and 2099, you probably don't want to set YEARCUTOFF=2000. Q: Can you give an example of the use and effect of the YEARCUTOFF= option? A: In the example below the YEARCUTOFF= option has been set to 1920 and the dates in the data have 2 and 4 digit years. This example illustrates how the YEARCUTOFF= option affects 2 digit years and has no effect on 4 digit years.
The output from PROC PRINT:
Q: What do I do if my dates with 2 digit years span more than 100 years? A: The YEARCUTOFF= option cannot reliably assign centuries to two-digit years if the range of dates for a variable is greater than 100 years. If the date ranges for a variable span more than 100 years, you must either specify the dates with 4 digit years, or use DATA step logic to assign a century to each year (perhaps based on the value of another variable). If the total range of dates in your data spans more than 100 years, but each variable covers less than a 100 year span, you can read the dates in with separate DATA steps, and change the value of the YEARCUTOFF= option between steps. For example, suppose you have a file with birthdates which range from 1900-1999 and a second file with appointment dates which all occur after 1990, and you want to merge the two files so you can print out a person's birthdate and appointment date. You can read the two files in with separate DATA steps and use a different YEARCUTOFF= value for each DATA step:
Q: Why does the YEARCUTOFF= option only allow a 100-year span? A: If the YEARCUTOFF= option allowed for more than a 100 year span, there would be no way to determine what century a 2 digit year should have. For example, let's assume YEARCUTOFF=1950 with a 150-year span and your external data file had 2 digit years. In this scenario your 150-year span would be from 1950 to 2100. Since you have 2 digit years, there would be no way to determine if the year 00 was meant to be 2000 or 2100. Default values for the YEARCUTOFF= optionQ: What is the default value of the YEARCUTOFF=option? A: Beginning with its introduction in Release 6.06, the default value for the YEARCUTOFF= option is 1900. In Version 7 and Version 8 the default setting is 1920. Note that you will not want to use the Version 6 default of 1900 in your applications that process dates after January 1, 2000.. Q: Why should I reset the YEARCUTOFF= option from the default setting of 1900 in Version 6? A: If the default YEARCUTOFF= value of 1900 is used, all dates with two digit years will be interpreted as being in the 1900's. For example, the date 26JUL05 will be interepreted as July 26, 1905. Note that if you are processing dates that don't go past 1999, you can use the default value of 1900. Q: I haven't changed my YEARCUTOFF= option; however, when I run PROC OPTIONS in Version 6, the value of YEARCUTOFF= is 1920 instead of the default of 1900. Why? A: Someone at your site has changed the default value of the YEARCUTOFF= option at the system level (see 'How do I change the default setting for all of the SAS users at my site?' below). You can override the value by specifying an OPTIONS statement in your program, in an autoexec or personal configuration file, by setting an environment variable, or by specifying the option at SAS invocation. The precedence of options affects which value the YEARCUTOFF= option will have for your program. Please see the SAS Language Guide for details on the order of precedence of options. Q: How do I change the default setting for all of the SAS users at my site? A: Setting system default option values is usually done by a site's SAS Installation Representative. The recommended method for setting a system default YEARCUTOFF= value is to specify the desired value in the system SAS configuration file. Note that even if you set a default value for all of the users at your site, they can override the default value in their SAS programs, in personal AUTOEXEC files, in CONFIG files, by setting an environment variable, or when invoking SAS software.
Q: How do I change the default setting for my own programs if I want a default that is different from the rest of the users at my site? A: You can specify personal default values either in a personal configuration file, or in an autoexec file. If you specify the value in a personal configuration file, the syntax depends on your operating system and is the same as that for setting the value in the system-wide configuration file on each system. If you use an autoexec file, you can specify the YEARCUTOFF= option in an OPTIONS statement; for example:
|