data a;
input x1 x2 x3 x4 x5 x6;
cards;
1 2 10 4 3 1 0
2 20 12 6 6 4
10 9 8 7 6 5
;
run;
data b;
set a;
array xx x1-x6;
do i=1 to dim(xx);
if xx{i}=max(of x1-x6) then max=i;
end;
do i=1 to dim(xx);
if max+i-1<=6 then xx{i}=xx{max+i-1};
else xx{i}=0;
end;
drop max i ;
run;