Hi all,
Currently the variable is formated as datetime22. like 01JAN2021:03:20:55.
How can I get the time out of this field in the output below ?
03:20:55
Thanks
In a data step, assuming your variable is named DATE
time=timepart(date);
format time time8.;
data _NULL_;
a='01JAN2021:03:20:55'dt; put a= datetime22.;
b=datepart(a) ; put b= date9.;
c=timepart(a) ; put c= time8.;
run;
/* end of program */
Koen
Especially as it would be my 100th solution. 😉
No worries!
I guess @EPANG1 will do it correct next time.
Koen
Apologies as I only see your answer in my inbox, but not displaying in the community forum. that's why I have copy the response again.
Again, no worries!
Maybe you had to refresh / reload the browser page you were looking at (?).
My answer is definitely in the thread.
Koen
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.