Hi Varun, Well, I cranked up an old PC with SAS on it, and with SYMBOLGEN on, I do see messages that SAS tried to resolve both VARUN and VARUNYZ, as I had expected: 8 options symbolgen;
9 %let m2=y;
10 %let m3=z;
11 %put &&&&&varun&m2&m3;
SYMBOLGEN: && resolves to &.
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Unable to resolve the macro variable reference &varun
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Unable to resolve the macro variable reference &varun
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable M2 resolves to y
SYMBOLGEN: Macro variable M3 resolves to z
WARNING: Apparent symbolic reference VARUNYZ not resolved.
&varunyz
I was surprised that the order of the symbolgen lines suggests that SAS tried to resolve &varun twice before &m2 and &m3. And I don't think I would trust symbolgen enough to believe it. If it's true, to me its an oddity of the word scanner/tokenizer/macro processor/whatever construct you choose, but one which does not impact the final outcome, of &varunyz being returned. And, if you define &varun, then the symbolgen messages are consistent with my belief that &m2 and &m3 are resolved in the first pass. In my mental map of how the macro languages work, below I think of symbolgen lines 1-5 as coming from a first pass which resolved to &&QYZ, line 6 from a second pass which resolved to &QYZ, and the warning message coming from a third pass which could not find a macro variable named QYZ. 12 options symbolgen;
13 %let varun=Q;
14 %let m2=y;
15 %let m3=z;
16 %put &&&&&varun&m2&m3;
SYMBOLGEN: && resolves to &.
SYMBOLGEN: && resolves to &.
SYMBOLGEN: Macro variable VARUN resolves to Q
SYMBOLGEN: Macro variable M2 resolves to y
SYMBOLGEN: Macro variable M3 resolves to z
SYMBOLGEN: && resolves to &.
WARNING: Apparent symbolic reference QYZ not resolved.
&Qyz
... View more