Having the actual data to work with makes a big difference 😁. So, here are a few lines from the CSV:
FATALITY_ID,EVENT_ID,FATALITY_TYPE,FATALITY_DATE,FATALITY_AGE,FATALITY_SEX,FATALITY_LOCATION
38341,817354,D,06/06/2019,97,M,Outside/Open Areas
38480,819069,D,06/09/2019,45,M,Vehicle/Towed Trailer
38532,820152,D,06/20/2019,,M,In Water
It's clear that these dates are written in the typical US format, month/day/year - or MMDDYY in SAS-speak. The dates are 10 characters wide, so we must use the INFORMAT MMDDYY10. to properly read the values. Once the proper INFORMAT for the date is supplied on the INFORMAT statement, it should work just fine:
data fatalities;
infile "/group/FATALITIES.csv" delimiter="," firstobs=2 dsd missover;
informat FATALITY_ID EVENT_ID FATALITY_TYPE $10. FATALITY_DATE mmddyy10.
FATALITY_AGE FATALITY_SEX $1. FATALITY_LOCATION $80.;
format FATALITY_DATE date9.;
input FATALITY_ID EVENT_ID FATALITY_TYPE FATALITY_DATE FATALITY_AGE
FATALITY_SEX FATALITY_LOCATION$;
run;
May the SAS be with you! Mark
... View more