How can one define a macro variable containing references to other macro variables which have not yet been defined without generating a warning?
Consider a program which generates similar plots for different variables. Depending on the variable, the label of each figure will change. Since all the figures have the similar labels, except for the particular analysis variable, it makes sense to place the label at the top of the program for easy modification. The problem is, at that point in the program, the variable name has not been yet been defined.
For example:
/*Top of program*/
%let label = This &thing gets defined later.;
/* ... */
/*Later in program*/
%let thing = macro variable;
%put &=label;
This produces the desired output:
LABEL=This macro variable gets defined later.
But it also generates a warning in the log:
WARNING: Apparent symbolic reference THING not resolved.
If I put an %nrstr
around &thing
, then the form of label
is correct (i.e . LABEL=This &thing gets defined later.
) However, &thing
no longer resolves after it has been defined.
/*Top of program*/
%let label = This %nrstr(&thing) gets defined later.;
%put &=label;
/* ... */
/*Later in program*/
%let thing = macro variable;
%put &=label;
This outputs:
LABEL=This &thing gets defined later.
LABEL=This &thing gets defined later.
Is there some way to avoid writing the warning to the log?