I am a relative novice to working with macro variables and seem to have gotten stuck.
I have a macro that opens a table and produces a macro variable &TBL_DIM. using PROC SQL select into.
%macro CREATE_DIM_VAR(tbl, var); %macro _; %mend _;
%syslput tbl = &tbl. / remote=gidwsas;
%syslput var = &var. / remote=gidwsas;
rsubmit;
PROC SQL NOPRINT;
*Create SELECT statement for columns we want;
SELECT ALL_DIM INTO: TBL_DIM SEPARATED BY ', '
FROM ALLDIM_LIST
WHERE TBL = "&TBL." AND VAR = "&VAR."
;
QUIT;
endrsubmit;
%mend;
%CREATE_DIM_VAR(A, GENDER);
When I do the following:
rsubmit;
%put &TBL_DIM.;
endrsubmit;
It works fine.
But now, when I try to call it within another macro:
%macro Execute(); %macro _; %mend _;
rsubmit;
%do n = 1 %to 10;
%let THIS_VAR = %scan(&TBL_DIM., &n.));
%put &THIS_VAR.;
%end;
endrsubmit;
%mend;
%Execute();
I get the error that: WARNING: Apparent symbolic reference TBL_DIM not resolved.
How do I pass TBL_DIM over to the other macro?
EDIT: When I modify %Execute() to run entirely from the Remote Server it works - but I still don't understand conceptually why...
rsubmit;
%macro Execute(); %macro _; %mend _;
%do n = 1 %to 10;
%let THIS_VAR = %scan(&TBL_DIM., &n.));
%put &THIS_VAR.;
%end;
%mend;
endrsubmit;
rsubmit;
%Execute();
endrsubmit;