Please advise how to readin following week date.
Data Test;
input weekdate ;
format weekdate DTWKDATX25.;
datalines;
Saturday, March 31, 2018
Monday April 2, 2018
;
Run;
You need to remove the redundant weekday first with substr(), then anydtdte will recognize the date:
data test;
input datestr $30.;
i = index(datestr,' ');
date = input(substr(datestr,i),anydtdte30.);
drop i;
format date weekdate30.;
cards;
Saturday March 31, 2018
;
run;
You only have dates, so a datetime format won't work.
The anydtdte informat can read a written (US style) date:
data test;
input date anydtdte30.;
format date yymmddd10.;
cards;
march 31,2018
;
run;
You need to remove the weekday first.
Hi Kurt,
I want to read Saturday March 31, 2018 and store it in date type variable as it is.
You need to remove the redundant weekday first with substr(), then anydtdte will recognize the date:
data test;
input datestr $30.;
i = index(datestr,' ');
date = input(substr(datestr,i),anydtdte30.);
drop i;
format date weekdate30.;
cards;
Saturday March 31, 2018
;
run;
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!
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.