I have a group of variables , say b1-b30 and i need to test same condition on same variables among themselves like, if b1='a' or b2='a' or b3='a'.. and so on. is there any solution in SAS macros or using of sas arrays to do this task to avoid writing this explicitly. sample code is like this:
data test;
input d1 d2 d3 d4 d5 ;
cards;
1 2 1 1 0
2 3 1 0 0
0 0 0 1 0
0 2 1 0 2
0 4 0 2 2
0 0 0 0 3
;
run;
data want;
set test;
if d1=1 or d2=1 or d3=1 or d4=1 then flag=1;
else flag=0;
run;
so i have around 50 variable , to test same condition and flag it .