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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.