I have a SAS dataset with three date variables (all character, $10) that I am trying to convert to SAS date variables using SAS 9.4. The first two (initialvisitdate and birthdate) are in the MM/DD/YY character format and the third (conceptiondate) has some observations in the MM/DD/YY format and some in the MM/DD/YYYY format. This is the code that I have been trying (with various date formats in place of 'anydtdte10.'): data test; set xxxx.xxxxxxxxxx; inivisitdt = INPUT(initialvisitdate, anydtdte10.); /* I have tried MMDDYY8. MMDDYY. etc */ birthdt = INPUT(birthdate, anydtdte10.); conceivedt = INPUT(conceptiondate, anydtdte10.); format inivisitdt birthdt conceivedt date9.; run; The 'conceptiondate' variable converts correctly from the 2 character formats described above, but only one observation for the initialvisitdate converted (observation 120 out of 289) - the rest are missing (.) and only 2 observations for the birthdate converted. There doesn't appear to be anything different for these 3 observations. There are no error or warning codes in the log. How can I convert all three of these variables?
... View more