05-11-2018 12:18 PM
I concatenate separate month and year variables into a single month-year variable, but the resulting variable is in a character format. I am trying to convert that into a SAS date variable to be able to calculate intervals with other date variables.
I am successful in the first step, but unable to get the month-year variable into a SAS date format. Below are the error I am getting and the SAS output. Any help would be much appreciated.
put date= ;
format date mmyy7.; run;
ERROR 48-59: The format $MMYYS was not found or could not be loaded.
05-11-2018 12:36 PM
A month and a year is not enough to convert to a SAS date. Dates in SAS refer to a specific day. If you are willing to use the first day of the month, you could use:
sasdate = input( cats(aamn, '01', aayear), mmddyy8.);
format sasdate yymmdd10.;
05-14-2018 11:22 AM
Thanks, your code is great. Because I needed to limit to the month and year, I found the other code more appreciate to my needs. I really appreciate your help.
Need further help from the community? Please ask a new question.