Hi,
Please help me to convert Char format $30. to Date9. format in SAS.
Date - 2017-10-24
New Date - 24OCT2017.
I tried the below code
format New Date date9.;
New Date= input(date,MMDDYY10.);
But I get blank values in the column.
Thanks
Look closely at the value of "date" such as 2017-10-14. Does that start with a Month? The MMDDYY informat is Month, day, year order.
You would use YYMMDD10. instead of MMDDYY10.
Bad idea to place spaces in the middle of variable names too.
NewDate= input(date,MMDDYY10.);
format newdate date9.;
Though one wonders why "date" is supposedly Char 30 if it only has 10 characters...
Date='2017-10-24';
NewDate= input(date,yymmdd10.);
format NewDate date9.;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.