Hi,
What if the date column has missing values from before and few dates have the wrong day (31& 32) .
Thanks,
@PrasadYadla wrote:
Hi,
What if the date column has missing values from before and few dates have the wrong day (31& 32) .
Thanks,
Enclosing the correcting code with an appropriate if-statement should help:
data a;
a="31apr2011";
output;
a="30feb2011";
output;
a = " ";
output;
a="15sep2011";
output;
run;
data last;
set a;
if not missing(a) then
do;
date=INPUT(a, ?? DATE9.);
if date=. then
do;
substr(a, 1, 2)='01';
date=intnx('month', input(a, date9.), 0, 'e');
end;
end;
format date date9.;
run;
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.
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.