2021年3月23日星期二

NOT+IN SAS operators combined, is this valid? Can't find documentation

I'm trying to understand how to code something along the lines of "NOT IN the LIST" type of logic in SAS. I figured I could do "NOT" + "IN" as something like below.

Data work.OUT;   Set work.IN;        If VAR=1 then OUTPUT=1;      else if VAR=2 then OUTPUT=2;      else if VAR NOT in (1,2) then OUTPUT=3;      else OUTPUT=4;      run;  

When I export the dataset all I see is OUTPUT=3 for all records. So something is happening in the derivation and it's transforming all VAR values into OUTPUT 3 values for some reason. Even though I know for a fact that other values exist in the VAR.

I don't understand what the problem is? Can we not combine NOT+IN operators? Alternatively, do you have any other ways of coding this type of logic in SAS? I rather not code each bit of code since I have more than 300 unique values for VAR

https://stackoverflow.com/questions/66771918/notin-sas-operators-combined-is-this-valid-cant-find-documentation March 24, 2021 at 06:00AM

没有评论:

发表评论