Hello,
I am needing some help in changing a datetime format back to a date format. For example, I have a value of 28OCT2013:21:26:58.819000
How can I create another variable and keep only the first 9 characters, in this case 28OCT2013 ? Can I do a simple SUBSTR command?
Help would be much appreciated!
You could use the DATEPART function. Or, simply apply a DATE format and leave the original value as is! See:
Do you mind if we dance with your DATEs (or DATETIMEs)? - The SAS Dummy
Chris
Thanks for the quick response.
I tried doing the simple date format, I used
28OCT2013:21:26:58.819000 (variable is called ofr_create_dt) and if I simply put
date(ofr_creat_dt) as date1
I got back a result of 19701?
Any ideas?
...
you then can format the date1 variable with date9. format and you get the date in a more readable format.
date(ofr_creat_dt) as date1
format date1 date9.;
Good luck!
Anca.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.