BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sallyjo
Calcite | Level 5

Hi, does anyone know how to format a SAS Date as MonDDYYYY, like JAN012018? 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Anytime, glad to help 🙂 Please remember to mark the appropriate answer as an accepted solution. This helps future users navigate the community 

View solution in original post

7 REPLIES 7
PeterClemmensen
Tourmaline | Level 20

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;

 

sallyjo
Calcite | Level 5
Thanks! How do I put a space between each, so it looks like Mon DD YYYY, JAN 01 2018?
PeterClemmensen
Tourmaline | Level 20

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;
sallyjo
Calcite | Level 5
Thanks!!!!
PeterClemmensen
Tourmaline | Level 20

Anytime, glad to help 🙂 Please remember to mark the appropriate answer as an accepted solution. This helps future users navigate the community 

ballardw
Super User

@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.

sallyjo
Calcite | Level 5

Thanks!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2510 views
  • 0 likes
  • 3 in conversation