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]

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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