Usage Note 6593: Converting a YYMMDD value into a SAS® date when YY is 00
Exercise caution when reading and converting numeric values into SAS dates when the numeric value is in the form YYMMDD and YY is 00. It is important to maintain the leading zeros when using the YYMMDDw. informat.
For example, consider a date value like 001230 (December 30, 2000) which is first read as a standard numeric value using the w.d informat. To convert the numeric value to a SAS date value, first use the PUT function with the Zw.d format (which preserves leading zeros), then use the INPUT function with the YYMMDDw. informat.
Some date values are stored in external files in packed decimal format and must be read into SAS using the PDw.d informat. These values can also be converted into SAS date values using the same PUT and INPUT function method described above.
The following is an example of using the PUT and INPUT functions to create a SAS date variable. The original numeric variable INDATE is read as a standard numeric using the 6. informat (or the PD4. informat, for packed decimal):
SASDATE=INPUT(PUT(INDATE,Z6.),YYMMDD6.);
Please see the SAS system option YEARCUTOFF= for more information about date values that contain ambiguous two-digit years.
Operating System and Release Information
| SAS System | Base SAS | z/OS | | |
| z/OS 64-bit | | |
| OpenVMS VAX | | |
| 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 95/98 | | |
| Microsoft Windows 8.1 Enterprise x64 | | |
| Microsoft Windows 8.1 Pro | | |
| Microsoft Windows 8.1 Pro 32-bit | | |
| Microsoft Windows 2000 Advanced Server | | |
| Solaris for x64 | | |
| Tru64 UNIX | | |
| Solaris | | |
| OpenVMS Alpha | | |
| OpenVMS on HP Integrity | | |
| Linux on Itanium | | |
| Linux | | |
| Linux for x64 | | |
| IRIX | | |
| HP-UX | | |
| HP-UX IPF | | |
| AIX | | |
| ABI+ for Intel Architecture | | |
| 64-bit Enabled HP-UX | | |
| 64-bit Enabled Solaris | | |
| 64-bit Enabled AIX | | |
| Windows Vista | | |
| Windows Vista for x64 | | |
| Windows Millennium Edition (Me) | | |
| Windows 7 Ultimate 32 bit | | |
| Windows 7 Ultimate x64 | | |
| Windows 7 Professional x64 | | |
| Windows 7 Professional 32 bit | | |
| Windows 7 Home Premium 32 bit | | |
| Windows 7 Home Premium x64 | | |
| Windows 7 Enterprise x64 | | |
| Microsoft Windows XP Professional | | |
| Windows 7 Enterprise 32 bit | | |
| Microsoft Windows Server 2012 Std | | |
| Microsoft Windows Server 2012 R2 Std | | |
| Microsoft Windows Server 2012 Datacenter | | |
| Microsoft Windows Server 2012 R2 Datacenter | | |
| Microsoft Windows Server 2008 for x64 | | |
| Microsoft Windows Server 2008 R2 | | |
| Microsoft Windows Server 2003 for x64 | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
*
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.
| Type: | Usage Note |
| Priority: | |
| Topic: | SAS Reference ==> Informats
|
| Date Modified: | 2002-01-07 12:45:53 |
| Date Created: | 2002-01-07 10:55:00 |