Hi, all
Does anybody know why we can't do something like the example below:
"%if &x = 1 and &y = 2 %then %do;"
Question:
Is not possible put "and" in the "%if" condition ?
9 | %LET X=1; |
10 %LET Y=2;
11 %MACRO TEST;
12
13 %IF &X=1 AND &Y=2 %THEN %DO;
14 | %PUT PASS; |
15 %END;
16 %ELSE %PUT FAIL;
17
18 %MEND;
19
20 %TEST;
PASS
You can, there's something else wrong in your program.
9 | %LET X=1; |
10 %LET Y=2;
11 %MACRO TEST;
12
13 %IF &X=1 AND &Y=2 %THEN %DO;
14 | %PUT PASS; |
15 %END;
16 %ELSE %PUT FAIL;
17
18 %MEND;
19
20 %TEST;
PASS
You can, there's something else wrong in your program.
Tk's Reeza, it was something wrong in my program.
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.