I am a beginner. I am trying to used input to convert text to date, here is my function
input('Jul-17', MONYY5.)
The result is Jul01, same month but the year is wrong.
please help
5 is the length but text is 6 characters. Remove the -
You can remove the dash with the COMPRESS() function if needed.
@linc wrote:
I am a beginner. I am trying to used input to convert text to date, here is my function
input('Jul-17', MONYY5.)
The result is Jul01, same month but the year is wrong.
please help
great thanks, the result is perfect 😄
input(compress('text',"-"),MONYY)
data w;
date=input('Jul-17', MONYY7.);
format date date9.;
run;
data test;
monthtext="January";
month=month(input("01"||substr(monthtext,1,3)||"2000",date9.));
run;from stackoverflow: https://stackoverflow.com/questions/9300020/sas-format-full-month-name-to-integer
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.