lilinzhong 发表于 2010-2-3 16:18 
data x;
input x y;
z=y>0+x>0; --------改成z=y>0; 可以
cards;
1 2
0 1
-1 3
;
run;
得不到正确的结果,why??
data x;
input x y;
z=sum(sign(x) ,sign(y) ); 用符号函数可以解决
cards;
1 2
0 1
. 3
;
run;
Boolean value in SAS has one of only two values, {1, 0} 1=
true , 0=
false
In the case
z=y>0+x>0;
is the same as z=y>(0+x)>0; accoring to the operation order.
x y
1 2 2>1>0 {true} z=1;
0 1 1>0>0 {false} z=0
-1 3 3>-1>0 {false} z=0
That is what you see.