Actually , It could be rewrited by WHICHN().
I think it is more readable for you .
data want;
array col(5) (1 4 5 5 4);
temp=max(of col(*));
idx=whichn(temp,of col(*));
col{idx}=.;
index_of_1nd=idx;
value_1=vname(col(index_of_1nd));
temp=max(of col(*));
idx=whichn(temp,of col(*));
col{idx}=.;
index_of_2nd=idx;
value_2=vname(col(index_of_2nd));
drop temp idx;
run;
... View more