I'm having a question regarding to converting partial SAS date.
I'm having some incomplete date like 'OCT 2018', this is a character variable and I want to convert it to '2018-10' also a character variable.
I'm thinking to change it to a numeric variable then convert that numeric to character variable. However since it is a partial date, I'm not sure how to do it.
Are you asking for how to convert the specific pattern MONYYYY into YYYY-MM?
If so you might have some success using the ANYDTDTE informat to convert that string to the first day of the month and then use the YYMMD format to generate the wanted string.
WANT=put(input(HAVE,anydtdte.),yymmd7.);
But how well it works depends on how messy your strings are.
SAS Innovate 2025: Register Now
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9. Sign up by Dec. 31 to get the 2024 rate of just $495. Register now!