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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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