BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dsr001
Calcite | Level 5
Hi,
I need to Extract SAS date from character field which is in the form of DD-MM-YYYY.
Can someone help?
Thanks and Regards
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data date;
date='02-07-2019';
sas_date=input(date,ddmmyy10.);
format sas_date ddmmyy10.;
run;

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20
data date;
date='02-07-2019';
sas_date=input(date,ddmmyy10.);
format sas_date ddmmyy10.;
run;
Reeza
Super User

Is that the only portion in the character field? If so, INPUT is easy enough. 

 

x = input(old_x, ddmmyy10.);

If you need to extract it from other text, you likely want regex or COMPRESS(). If you need help with the actual code, you'll need to provide some examples of your data otherwise what we write likely won't work for your data.

 


@dsr001 wrote:
Hi,
I need to Extract SAS date from character field which is in the form of DD-MM-YYYY.
Can someone help?
Thanks and Regards

 

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
  • 2 replies
  • 1446 views
  • 1 like
  • 3 in conversation