I defined one macro variable VAR, then I wrote the codes as below;
%if %UPCASE(&VAR) NOT IN ("ABC", "XYZ") %THEN %DO;
BLABLABLA;
%END;
It seems incorrect, is there one statement in MACRO equal to "not in" or "in" statement?
Thanks in advance.
you need to use option:
example:
options minoperator;
%if &state in (NY NJ PA) %then %let ®ion = %eval(®ion + 1);
more detail at http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003092012.htm
you need to use option:
example:
options minoperator;
%if &state in (NY NJ PA) %then %let ®ion = %eval(®ion + 1);
more detail at http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003092012.htm
Got it. Thanks
Actually, since you are using macro code, I think you will also need a macro option as well:
%let var=ABC;
options minoperator;
%macro test/mindelimiter=',';
%if not(%upcase(&VAR) in (ABC,XYZ)) %THEN %DO;
%put met condition;
%END;
%else %do;
%put did not meet condition;
%end;
%mend test;
%test
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.