Hi everyone,
How can I read this type of dates in eGuide?
Tuesday, 11th June 1985 |
Monday, 4th June 1990 |
Thx!
David
Tis fixed the problem:
data test;
F5='Friday, 10th January 1986';
worddate=left(scan(F5,2,','));
day=substr(worddate,1,2);
monthname=scan(worddate,2, ' ');
month=substr(monthname,1,3);
year=scan(worddate,3,' ');
date9=input(catt(day,month,year),date9.);
run;
proc print ; run;
I don't think you'll be able to read these without doing some further processing. Are they always in the form
<weekday>, <date>th <month> <year>
If they are, it is very easy to reformat them to be converted.
Tom
Tis fixed the problem:
data test;
F5='Friday, 10th January 1986';
worddate=left(scan(F5,2,','));
day=substr(worddate,1,2);
monthname=scan(worddate,2, ' ');
month=substr(monthname,1,3);
year=scan(worddate,3,' ');
date9=input(catt(day,month,year),date9.);
run;
proc print ; run;
Perfect. That's exactly the way to do things like this in SAS.
Your day assignment may not work with single digit dates.
day=substr(worddate,1,(notdigit(worddate)-1));
should fix it.
Tom
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.