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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1055 views
  • 2 likes
  • 3 in conversation