My code1 below creates a where clause in Proc SQL based on user prompt input('Str' for store number) I'd like to use a Macro (see sample code2 below) to replace the Macro variable. How can I make it work please? Thanks!
Code 1:
%global STR_COUNT STR;
%let STR_WHERE_CLAUSE=;
data _null_;
if missing(symget('str'))=0 then
do;
length STR_LIST $1000;
STR1=symget('STR');
STR2=put(input(STR1,best4.),z4.);
STR_LIST=quote(STR2);
put STR_LIST;
end;
if missing(STR_LIST)=0 then
call symputx('STR_WHERE_CLAUSE',cats(' and T1.STR_SITE_NUM in (',STR_LIST,')'));
run;
%PUT &STR_Where_Clause;
Code 2:
%macro condition3(table=);
and &table..store in ('1234')
%mend condition3;
then I can use the macro in SQL just like the macro variable.
select xxx from t1, t2 where condition1
and condition2
%condition3(table=t6)