Hello,
Assuming you have character dates as input :
data have;
length date_1 date_2 $10;
input id date_1 $ date_2 $;
cards;
1 01/01/2018 05/16/2017
2 02/03/2018 06/25/2016
3 12/21/2017 03/01/2015
;
run;
data _NULL_;
set have end=eof;
call execute('data want; set have(rename=(');
length colname $32;
do while (upcase(colname) ne "COLNAME");
call vnext(colname);
if colname=:"date" then do;
call execute(cats(colname,'=old_',colname));
end;
end;
call execute('));');
colname="";
do while (upcase(colname) ne "COLNAME");
call vnext(colname);
if colname=:"date" then do;
call execute(catx(' ','format',colname,'date9.;',colname,'=input(old_'||colname,', mmddyy10.);'));
end;
end;
call execute('drop old_:; run;');
stop;
run;
... View more