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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: