Dates
This code reads date of birth as a character string, as an unformatted number, and as a date formatted number:
DATA POINTER; INPUT @1 ID 3. @13 CharDOB $6. @13 NumDOB MMDDYY6. @13 DOB MMDDYY6.; FORMAT DOB MMDDYY8.; DATALINES; 101 M 26 68 012366 102 M 32 78 031460 103 F 45 62 112647 104 F 22 66 080170 ; PROC PRINT DATA=POINTER; TITLE 'Example 6, modified'; RUN;
When reading the data above, the code produces the following output:
Example 6, modified OBS ID CHARDOB NUMDOB DOB 1 101 012366 2214 01/23/66 2 102 031460 73 03/14/60 3 103 112647 -4419 11/26/47 4 104 080170 3865 08/01/70