yes - just use it as you've written it (almost).
where varname not in (1,2,3);
Dare to experiment - error messages are free!
Editor's note: consolidating some other helpful comments in this solution...
@bhthomas99 asks about the NOTIN operator (no space). @abbess replied:
The NOTIN operator work perfectly, I have tried it my self. Also it is mentioned in the SAS Support that NOT is a prefix wich can be used with other operators.
"A prefix operator is an operator that is applied to the variable, constant, function, or parenthetic expression that immediately follows it. The plus sign (+) and minus sign (-) can be used as prefix operators. The word NOT and its equivalent symbols are also prefix operators"
See SAS Operators in Expressions (SAS documentation)
And @Doc_Duke points out that order-of-operations matters:
Be careful combining NOT, AND, and OR; you don't always get what you think, especially if you leave it to SAS to resolve the expression. For instance, not varname IN (1, 2, 3) does not give the same answer as not (varname in (1,2,3)
... View more