/* this is a good example using array, do-loop and if-then */
data test;
input A $ B $ C $;
datalines;
0 0 JingWai
GuoYou 0 0
0 JingWai 0
GuoYou 0 0
0 JingWai 0
;
run;
/* this is a standard example of array and do-loop */
data want1;
set test;
array myarray{3} a b c;
do i = 1 to dim(myarray);
if myarray(i) ^="0" then d = myarray(i);
end;
drop i;
run;
/* T ...
/* this is a good example using array, do-loop and if-then */
data test;
input A $ B $ C $;
datalines;
0 0 JingWai
GuoYou 0 0
0 JingWai 0
GuoYou 0 0
0 JingWai 0
;
run;
/* this is a standard example of array and do-loop */
data want1;
set test;
array myarray{3} a b c;
do i = 1 to dim(myarray);
if myarray(i) ^="0" then d = myarray(i);
end;
drop i;
run;
/* This is an example of using do-OVER loop with array and if-then */
data want2;
set test;
array Use_Over a b c;
do over Use_Over;
if Use_Over ^="0" then d2 = Use_Over;
end;
run;