SAS Support Site Home | Samples and SAS Notes Home
SAS Notes V6-INFORMATS-F677
Reading numeric dates containing a century indicator


The example below shows how to read date values that contain a century indicator in the first byte in the form of cyymmdd, where a value of 0 (zero) for 'c' indicates the 20th century (i.e. 19nn) and a value of 1 (one) indicates the 21st century (i.e. 20nn). This technique adds 19,000,000 to the numeric value, which adjusts it to the format of yyyymmdd, then uses the PUT and INPUT functions with the YYMMDD8. informat to create a SAS date variable:

    data test;
      input date;
      date = date + 19000000;
      sasdate = input(put(date,8.),yymmdd8.);
      format sasdate date9.;
    cards;
    0990503
    1010503
    ;

If date values are not in the form of cyymmdd refer to SAS Note V6-INFORMATS-F682.


Products: BASE
Component: INFORMATS
Priority: N/A
Status: Usage Issue
Date: Tue, 23 Feb 1999

System Release Reported Release Fixed
VM/ESA (CMS) 6.09 TS450  
OS/390 (MVS) 6.09 TS450  
OpenVMS VAX 6.09 TS450  
AIX/6000 6.12 TS020  
HP-UX Operating Systems 6.12 TS020  
IBM OS/2 6.12 TS020  
Solaris 6.12 TS020  
OpenVMS Alpha 6.12 TS020  
Windows 3.11 6.12 TS020  
Windows NT 6.12 TS020  
Windows 95 6.12 TS020  
Compaq Tru64 Unix 6.12 TS040  
Macintosh 6.12 TS040  

No Fixes Available