Hi All,
How to change the date&time fromat from 09SEP21:00:00:00 to 09-SEP-2021 00:00 (DD-MMM-YYYY HH:MM). Please help.
I don't know of such a format out-the-box.
However, you can roll out your own format like this
proc format;
picture dtfmt (default=20)
other = '%0d-%b-%Y %0H:%0M' (datatype = datetime)
;
run;
data _null_;
dt = '09SEP2021 00:00:0'dt;
put dt dtfmt.;
run;
You mentioned formatting of dates, but your description of what you want is for DATETIME values (number of seconds) not DATE values (number of days).
Do any of the datetime values you need to display contain actual non-zero value for the time of day component? If not then why not just convert the values from seconds to days by using the DATEPART() function and then use the DATE11 format to display the dates in DD-MON-YYYY style?
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.