I need to loop over some macro variables in my data step i have tried to define the macro variable and build them dynamically in the data step like this
DATA _NULL_;
call symputx('_rbank_1',put(001,z3.));
call symputx('_rwebhost_1','company1.myhost.com');
call symputx('_rbank_2',put(008,z3.));
call symputx('_rwebhost_2','company2.myhost.com');
call symputx('_rbank_3',put(008,z3.));
call symputx('_rwebhost_3','company3.myhost.com');
RUN;
%let _rbank_1 = &_rbank_1;
%let _rwebhost_1 = &_rwebhost_1;
%let _rbank_2 = &_rbank_2;
%let _rwebhost_2 = &_rwebhost_2;
%let _rbank_3 = &_rbank_3;
%let _rwebhost_3 = &_rwebhost_3;
data test;
do cnt=1 to 3;
macroString=compress("&_rwebhost_"||cnt);
marcroValue=macroString;
end;
run;
But the output of macroValue is "&_rwebhost_3" and i need it to be the value not the name.
I can do this in macro but i really need it in a data step . Normally in other programming language i would define a hash table but that doesn't seem to be that simple in sas datastep.