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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.