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

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1350 views
  • 1 like
  • 3 in conversation