%IF (&Variable NOT IN (Apples Oranges)) %THEN %DO;
can try this, for you to use not in in macro , you have to use the %eval; but you can create a call symputx that will store the values apple and oranges , eg. lets say the macro variable with the name apple,oranges is fruits, so the macro &fruits will resolve to apple and oranges. so i will have the following code
also remember to put the options statement at the top of the macro;
options minioperator mindelimiter=",";
like this
%if not %eval (%upcase(&fruits) in APPLES,ORANGES) %then %do;
> I was wondering is it possible to use "Not IN" in a conditional statement using the macro facility.
Yes it is. Look at the minoperator and mindelimiter options.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.