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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.