how about this.
data have;
infile datalines dsd missover;
input ID (Proc1 Proc2 Proc3 Proc4)(:mmddyy10.);
format Proc1-Proc4 mmddyy10.;
datalines;
10,,,03/30/2021
10,03/31/2021
10,,,,03/27/2021
20,03/20/2021
20,,03/20/2021
20,,,03/20/2021
20,,,,03/20/2021
;
run;
data want;
set have;
by id;
array prockeep{4} _temporary_;
array procvar{4} proc1-proc4;
retain prockeep:;
if first.id then do;
do i=1 to dim(prockeep);
prockeep{i}=.;
end;
end;
do i=1 to dim(prockeep);
if procvar{i}^=. then prockeep{i}=procvar{i};
end;
if last.id then do;
do i=1 to dim(prockeep);
procvar{i}=prockeep{i};
end;
output;
end;
drop i;
run;
Variables are numeric, so it can't be display NA.
... View more