Hi
Assuming that zero values always are in the end, here is a simple solution:
data want; set have;
array values Largest Second Third Fourth Fifth Sixth;
drop i j firstempty;
* find first zero-value column - i.e. length of series to repeat + 1;
do i = 2 to 6;
if values{i} = 0 then do;
firstempty = i;
leave;
end;
end;
* replace with value from corresponding element in non-zero series;
if firstempty ne . then do j = firstempty to 6;
values{j} = values{j - firstempty + 1};
end;
run;
... View more