Hi, does anyone know how to format a SAS Date as MonDDYYYY, like JAN012018?
Anytime, glad to help 🙂 Please remember to mark the appropriate answer as an accepted solution. This helps future users navigate the community
Not sure if there is one 'out of the box', but you can roll out your own like this
proc format;
picture dtfmt (default=9)
low - high = '%b%D%Y' (datatype=date)
;
run;
data test;
date='01jan2018'd;
format date dtfmt.;
run;
no problem 🙂 Change the length from 9 to 11 and add the spaces like this
proc format;
picture dtfmt (default=11)
low - high = '%b %D %Y' (datatype=date)
;
run;
data test;
date='01jan2018'd;
format date dtfmt.;
run;
Anytime, glad to help 🙂 Please remember to mark the appropriate answer as an accepted solution. This helps future users navigate the community
@sallyjo wrote:
Thanks! How do I put a space between each, so it looks like Mon DD YYYY, JAN 01 2018?
There is the SAS supplied WORDDATE12. format that displays as Jan 1, 2018 if interested. Wider widths such as WORDDATE18. spell out the month to January 1, 2018. Of course if you don't want a comma this isn't the format for you.
Thanks!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.