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.;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.