Mlk
Mlk

Reputation: 91

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

i have a table Z with two columns a(string) and b(integer) the elements in a change for every session so i crate a macro variable to each session !

%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);

I hope that's clear enough for u , The error is :"Expecting a )"

Upvotes: 1

Views: 183

Answers (1)

Llex
Llex

Reputation: 1770

It means that you missed a ).

You should use in operator with list of values in () in where statement.

It will look like:

where a in (&Fe.)

Upvotes: 2

Related Questions