是否有检查宏变量中是否存在元素的函数?

Is there a function to check if an element exist in a macro variable?

我有一个 table Z 有两列 a(string) 和 b(integer) 每个会话的元素都会发生变化,所以我为每个会话创建了一个宏变量!

%Let Fe='abc','def','mno';
%let mylist = &session_1. &session_2. &session_3.;

%macro print_session_3(mylist) / minoperator ; 
%let session_3=session_3;
    %IF  &session_3. in &mylist. %THEN %DO;
        proc sql;
            create table DATA.session_3 as
        select  a , b
        from source.Z
            where a in &Fe.
        and b>4
    ;quit;
    %end; 
%mend;
%print_session_3(&mylist);

我希望你已经足够清楚了,错误是:"Expecting a )"

表示你错过了一个).

您应该在 where 语句中对 () 中的值列表使用 in 运算符。

看起来像:

where a in (&Fe.)