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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.