Hi,
Thanks to my brother for this idea - works well. Basically recode the odd importance of variables to a consecutive order.
data test2 (drop=head_status_1 - head_status_3 head_status);
set trial1 ;
* rank employment vars;
head_status = .;
head_status_1 = .;
head_status_2 = .;
head_status_3 = .;
array weight{2,9} (2 1 3 4 5 7 6 8 9 9 8 7 6 5 4 3 2 1);
do j=1 to 9 until (head_status_1 - head_status_3 ne .) ;
if ER17216 = weight(1,j) then head_status_1 = weight(2,j);
if ER17217 = weight(1,j) then head_status_2 = weight(2,j);
if ER17218 = weight(1,j) then head_status_3 = weight(2,j);
if head_status_1 or head_status_2 or head_status_3 = 9 then leave;
end;
head_status = max(head_status_1, head_status_2, head_status_3);
head_status_01 = .;
do j=1 to 9 until (head_status_01 ne .);
if head_status = weight(2,j) then head_status_01 = weight(1,j);
end;
run;
... View more