z**l 发帖数: 82 | 1 Ask for help!!
I have data a:
if x1,x2 or x3 = (b or z) then y=1
else y=0.
I need have a data like data b.
data a;
input x1$ x2 $ x3 $ ......x190 $;
cards;
b 1 2 ........
1 0 1 ........
2 z 2 ........
1 1 b ........
;
run;
data b:
x1 x2 x3 ....x190 y
b a 2 2 1
1 0 1 ........ 0
2 z 2 ........ 1
1 1 b ........ 1 | s*********e 发帖数: 1051 | 2 data a (drop = i);
input x1 $ x2 $ x3 $;
y = 0;
array x{*} _character_;
do i = 1 to dim(x);
if x{i} in ('b', 'z') and y = 0 then y = 1;
else y = y;
end;
cards;
b 1 2
1 0 1
2 z 2
1 1 b
;
run; | z**l 发帖数: 82 | |
|