BookmarkSubscribeRSS Feed

If SAS attempts to resolve a macro variable reference and cannot, it throws a helpful warning (assuming default option SERROR is on):

1    %put &nope ;
WARNING: Apparent symbolic reference NOPE not resolved.

Unfortunately, if the the macro processor makes multiple passes of a token (because of multiple ampersands), it does NOT throw a warning when a macro reference cannot be resolved on one of the intermediate passes.  As an example, the following code mistakenly has three ampersands in front of VAR instead of two.  On the first pass, the first two ampersands resolve to  a single ampersand, and then SAS tries to resolve macro reference &var and it cannot.  At that point, I would like to see SAS throw a warning that symbolic reference VAR cannot be resolved.


%let var1=foo ;
%let i=1 ;

%put &&&var&i ;

If you turn on symbolgen, it shows the resolution process, and shows that SAS tried to resolve VAR:


8    options symbolgen ;
10   %put &&&var&i ;
SYMBOLGEN:  && resolves to &.
SYMBOLGEN:  Unable to resolve the macro variable reference &var
SYMBOLGEN:  && resolves to &.
SYMBOLGEN:  Macro variable I resolves to 1
SYMBOLGEN:  Macro variable VAR1 resolves to foo

The WARNING is useful, and would be helpful to have it generated any time there is a failed resolution attempt.  I don't see any value to suppressing this warning when there are multiple resolution passes.

Rhodochrosite | Level 12

Yes -- make this an option.  

Jade | Level 19

I support this suggestion as well, since there is no other way to get SAS to report this information.