> Thanks, I am looking for a condition that FOLLOWS the
> variable only as I am doing a lookup of a table that
> contains only the part after the variable. i.e. I am
> looking for "IF X then ...", where
> is kept in the lookup table. E.g.
> is , except you
> can't use BETWEEN with the IF statement.
...
If the can contain the name of the variable (which will likely be the case when the lookup key is indeed the variable name), then you can do something like below. That is the part being:
[pre]
= ifn(x=0|missing(x), 999, ifn(1.3<=x<=10.7,x,-x))
[/pre]
hope this helps a bit.
[pre]
data _null_;
do x = ., 0, 1.26, 6.26, 10.71;
if x = ifn(x=0|missing(x), 999, ifn(1.3<=x<=10.7,x,-x)) then y = 1;
else y = 0;
put x= y=;
end;
run;
/* on log
x=. y=0
x=0 y=0
x=1.26 y=0
x=6.26 y=1
x=10.71 y=0
*/
[/pre]
Wait a minute. If you are *not* allowed to do a like:
[pre]
>= 1.3 and x <= 10.7
[/pre]
then, there is no hope. This cannot be done, as far as I know, that is.
... View more