In IFN, all expressions will be evaluated at first. And then logical judgement will be applied and regarding value be returned, while IF/THEN/ELSE need not evaluate all expressions.
data test1;
input a b ;
l=ifn(b>0 , 0 , a/b );
* 'b>0' and 'a/b' will be evaluated, so error occur;
cards;
10 2
6 0
9 3
;
data test2;
input a b;
if b=0 then l=0;
else l=a/b;
cards;
10 2
6 0
9 3
;
No comments:
Post a Comment