Hello,
I have imported code below. But the log page showed error message below. Please advice how to fix it.
Data residences;
infile "\\Pathway\ResidencesDates.csv" dlm="," dsd missover lrecl=32000 firstobs=2;
;
input
Id
ResStartMM_1
ResStartYY_1
ResStopMM_1
ResStopYY_1
;
Format ResStartMM_1 DateMM.;
Format ResStartYY_1 DateYY.;
Format ResStopMM_1 DateMM.;
Format ResStopYY_1 DateYY.;
Label ResStartMM_1="Residence Start Date Month";
Label ResStartYY_1="Residence Start Date Year";
Label ResStopMM_1="Residence Stop Date Month";
Label ResStopYY_1="Residence Stop Date Year";
RUN;
The error message in the Log page:
45 Format ResStartMM_1 DateMM.;
-------
48
ERROR 48-59: The format DATEMM was not found or could not be loaded.
46 Format ResStartYY_1 DateYY.;
-------
48
ERROR 48-59: The format DATEYY was not found or could not be loaded.
47 Format ResStopMM_1 DateMM.;
-------
48
ERROR 48-59: The format DATEMM was not found or could not be loaded.
48 Format ResStopYY_1 DateYY.;
-------
48
ERROR 48-59: The format DATEYY was not found or could not be loaded.
Months and years are numeric variables that don't need formats.
Are you trying to change how they are displayed? If the answer is no, then just get rid of the format statements.
Months and years are numeric variables that don't need formats.
Are you trying to change how they are displayed? If the answer is no, then just get rid of the format statements.
I paste the code below again.
Data residences;
infile "\\Pathway\ResidencesDates.csv" dlm="," dsd missover lrecl=32000 firstobs=2;
;
input
Id
ResStartMM_1
ResStartYY_1
ResStopMM_1
ResStopYY_1
;
Format ResStartMM_1 DateMM.;
Format ResStartYY_1 DateYY.;
Format ResStopMM_1 DateMM.;
Format ResStopYY_1 DateYY.;
Label ResStartMM_1="Residence Start Date Month";
Label ResStartYY_1="Residence Start Date Year";
Label ResStopMM_1="Residence Stop Date Month";
Label ResStopYY_1="Residence Stop Date Year";
RUN;
Below is my CSV file. It's in the numbers was in general format in Excel. I'm not sure if you could see that.
Id | ResStartMM_1 | ResStartYY_1 | ResStopMM_1 | ResStopYY_1 |
30005 | 2 | 1994 | 6 | 2001 |
Hi @ybz12003
Those are not valid formats.
Try to use date9., etc. (cf https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n16vcb736tg...)
Hope that helps.
Cheers,
Damien
Use valid formats. You can find a lit of them on:
Thank you all your prompt reply. I got it fixed.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.