Hello,
May you help with what is wrong about following macro? Thank you. -Ivy
%macro t ;
%let group = 'SORAFENIB_1stline' ;
%if &group. in ( 'SORAFENIB_1stline' , 'commercial', 'Cirrhosis', 'meta') %then %do;
proc sql;
select count(distinct enrolid) into: cntt
from ads.cohort ;
quit;
%end;
%mend;
%t;
15 %macro t ;
16 %let group = 'SORAFENIB_1stline' ;
17
18 %if &group. in ( 'SORAFENIB_1stline' , 'commercial', 'Cirrhosis', 'meta') %then %do;
19 proc sql;
20 select count(distinct enrolid) into: cntt
21 from ads.cohort ;
22 quit;
23 %end;
24 %mend;
25
26 %t;
MLOGIC(T): Beginning execution.
MLOGIC(T): %LET (variable name is GROUP)
ERROR: Required operator not found in expression: &group. in ( 'SORAFENIB_1stline' , 'commercial', 'Cirrhosis', 'meta')
ERROR: The macro T will stop executing.
MLOGIC(T): Ending execution.
MINOPERATOR
IN wasn't always supported in SAS macros, so when it was added to keep backwards compatibility it requires you to set the option.
You can check the docs on how the specifics work, but you can add it to your macro definition, which is the easiest option.
%macro t / MINOPERATOR;
MINOPERATOR
IN wasn't always supported in SAS macros, so when it was added to keep backwards compatibility it requires you to set the option.
You can check the docs on how the specifics work, but you can add it to your macro definition, which is the easiest option.
%macro t / MINOPERATOR;
In addition, you will need to specify what delimiter the IN operator should use. A comma is permitted as the delimiter, but then you should not have spaces on either side of the commas in your %IF %THEN statement. The name of the global option is MINDELIMITER:
And you will need to get rid of the parentheses around the list of items. The macro language IN operator doesn't use them.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.