SAS reading data that has two different date format

Опубликовано: 26 Февраль 2026
на канале: Linuxanthus
778
2

This tutorial is to use inputn function to read column that has date with more than one format. If your source data has column with two different date format then this tutorial will be helpful to read those data.

Program used:
data fixdates (drop=start readdate);
length jobdesc $12 readdate $8;
input source id lname $ jobdesc $ start $;
if source=1 then readdate= 'date7. ';
else readdate= 'mmddyy8.';
newdate = inputn(start, readdate);
datalines;
1 1604 Ziminski writer 09aug90
1 2010 Clavell editor 26jan95
2 1833 Rivera writer 10/25/92
2 2222 Barnes proofreader 3/26/98
;

Reference - The Power of Proc Format book