data date;
date='02-07-2019';
sas_date=input(date,ddmmyy10.);
format sas_date ddmmyy10.;
run;
data date;
date='02-07-2019';
sas_date=input(date,ddmmyy10.);
format sas_date ddmmyy10.;
run;
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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.