2组数据A1-A3,B1-B4,都是01变量,满足A*=1 and B*=1,则put F
data a;
input No$ A A1 A2 A3 B1 B2 B3 B4 F$;
cards;
1        1        1        0        0        1        0        1        0        4
2        2        0        1        0        0        1        0        0        5
3        3        0        0        1        0        0        1        0        6
4        2        0        1        0        0        1        0        1        7
5        2        0        1        0        0        1        0        1        10
6        1        1        0        0        0        1        0        0        5
;
run;
结果应该是
A1*B1     4
A1*B3     4
A2*B2     5
A3*B3     6
A2*B2     7
A2*B4     7
A2*B2     10
A2*B4     10
A1*B2     5
为了说明我的需求,下面是我写的很傻的内容,希望不要见笑,谢谢~
data _null_;
set a;
if A1=1 and B1=1 then put "A1*B1" +5 F;
if A1=1 and B2=1 then put "A1*B2" +5 F;
if A1=1 and B3=1 then put "A1*B3" +5 F;
if A1=1 and B4=1 then put "A1*B4" +5 F;
if A2=1 and B1=1 then put "A2*B1" +5 F;
if A2=1 and B2=1 then put "A2*B2" +5 F;
if A2=1 and B3=1 then put "A2*B3" +5 F;
if A2=1 and B4=1 then put "A2*B4" +5 F;
if A3=1 and B1=1 then put "A3*B1" +5 F;
if A3=1 and B2=1 then put "A3*B2" +5 F;
if A3=1 and B3=1 then put "A3*B3" +5 F;
if A3=1 and B4=1 then put "A3*B4" +5 F;
run;