BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Ok, I've been on holiday for the past week and seem to have lost all SAS ability. All I'm looking to do is convert a $5 formatted variable to a ddmmyy. date.

For example, I want the value 'JAN11' to be converted to '01JAN11'.

Can anyone help?

Many thanks
3 REPLIES 3
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Wacattack,

This is a code:
[pre]
data a;
d="jan11";
date=INPUT("01"||d,anydtdte7.);
format date date7.;
run;
[/pre]
Sincerely,
SPR
deleted_user
Not applicable
Thanks mate, works perfectly
data_null__
Jade | Level 19
The specific INFORMAT is MONYY

[pre]
116 data _null_;
117 x = 'jan11';
118 d = input(x,monyy.);
119 put d=date9. d=monyy.;
120 run;

d=01JAN2011 d=JAN11
[/pre]

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
  • 3 replies
  • 989 views
  • 0 likes
  • 3 in conversation