I have the following macro:
%macro regex_builder;
%do i = 1 %to 11;
data _null_;
a = &i.;
call symputx('Var', a, 10.);
run;
proc sql noprint;
select Regex into :regex_string_&Var
from Regex
where monotonic() = &i.;
quit;
%put &®ex_string_&Var;
%end;
%mend;
%regex_builder;
The purpose of this is to loop through the rows of a dataset and assign the values contained within to a series of macro variables i.e. regex_string_1
, regex_string_2
etc.
The required data is being assigned to a macro variable of some sort as when I use %put &®ex_string_&Var;
I am getting a series of macro variable strings in the correct order and generated from the my source dataset.
However, when I try and resolved the macro variables created with the above naming convention of regex_string_1
, regex_string_2
etc I get a warning saying that these macro variable names have not been declared.
What I would like to know is:
1) Why is my code above not working as intended 2) How can I print the resolved name of a macro variable name made up from other macro variables as above to the SAS log?
Thanks