can i please get help on this,
wants to convert below character value to date value
Have
char_var=2015.09.19 /*sorry but this is character value that i ended up by pulling it out from long string)*/
want
date_var=09192015 /*want it as a date*/
thank you in advance,
date_Var=mdy(scan(char_var,2,'.')+0,scan(char_var,3,'.')+0,scan(char_var,1,'.')+0);
format date_Var mmddyy8.;
date_Var=mdy(scan(char_var,2,'.')+0,scan(char_var,3,'.')+0,scan(char_var,1,'.')+0);
format date_Var mmddyy8.;
While I can't test this at the moment, you should be able to read the character string directly:
date_var = input(char_var, yymmdd10.);
That will give you the proper date value. For display purposes, choose the date format that you would like. To match the result you originally asked for:
format date_var mmddyyn8.;
Good luck.
to Astounding
i don't know why but i used that trick already and i am receiving error saying "limit set by errors= option reached,..."
Miller trick worked though after using format function date9.;
date_want=input(date_have, anydtdte10.);
format date_want date9.;
This works for me.
Yes Reeza that worked, thanks
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 lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.