data have; infile cards dlm='09'x truncover; data have; infile cards dlm='09'x truncover; input id a b c; cards; 1 2 2 1 2 3 1 0 3 1 0 4 4 1 2 3 5 3 2 1 ; run; want: id a b c g1 g2 g3 g4 1 2 2 1 1 1 0 0 2 3 1 0 1 1 1 0 3 1 0 4 1 1 1 1 4 1 2 3 1 1 1 0 5 3 2 1 1 1 1 0 So, If a--c is >=1 then g1=1 If a--c is >=2 then g2=1 If a--c is >=3 then g3=1 If a--c is >=4 then g4=1 code: data want; set have; array input(*) a--c; do i=1 to dim(input); if input{_n_} ge 1 then g1=1; if input{_n_} ge 2 then g2=1; if input{_n_} ge 3 then g3=1; if input{_n_} ge 4 then g4=1; end; run;
... View more