Reputation: 11
I am stuck writing a piece of code that features macro variables of the form &&var&i. Let me give a small example:
%macro test;
%let i=1;
%let name1=Tom;
%put &&name&i;
%mend;
%test;
This gives a warning: "Apparent symbolic reference NAME not resolved." I thought the %put statement should resolve to
1st step: &name1 (&&-->& and &i-->1)
2nd step: Tom
It seems that in the first step already, SAS searches for the macro variable &name, although there are two ampersands in front of it.
This is the SAS log, with symbolgen enabled.
WARNING: Apparent symbolic reference NAME not resolved.
SYMBOLGEN: Macro variable I resolves to 1
&&name1
Am I missing something or are there SAS settings that I should check? Thanks in advance!
Upvotes: 1
Views: 281
Reputation: 1804
Restarting the session seems to have solved the problem for you as Quentin commented.
Other options you can try if the same problem persists is turning on symbolgen
option and add dot to resolve the macro variable names %put &&name&i..;
Upvotes: 0