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

how to populate date like this 

DAT                                               from this format to this format

31DEC2019                                           31 DEC 2019

01MAR2020                                          01 MAR 2020

08MAR2020                                          08 MAR 2020

1JUN2020                                             01 JUN 2020

 

With space

 

Thanks in Advance

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Try this

 

data have;
input date :date9.;
format date date9.;
datalines;
31DEC2019 
01MAR2020 
08MAR2020 
01JUN2020 
;

proc format; 
  picture dtfmt (default=12)
    low - high = '%D %3b %Y' (datatype=date)
  ;
run;

data want;
   set have;
   format date dtfmt.;
run;

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

Supposing your data is a SAS date and not a string, your best bet is probably to create a picture format to display the date as you request.

PeterClemmensen
Tourmaline | Level 20

Try this

 

data have;
input date :date9.;
format date date9.;
datalines;
31DEC2019 
01MAR2020 
08MAR2020 
01JUN2020 
;

proc format; 
  picture dtfmt (default=12)
    low - high = '%D %3b %Y' (datatype=date)
  ;
run;

data want;
   set have;
   format date dtfmt.;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 1625 views
  • 2 likes
  • 3 in conversation