I have a macro that resolves to a string which contains an ampersand and this cause the error WARNING: Apparent symbolic reference A not resolved
.
For example
Data _NULL_;
T=%NRSTR("A&A");
call symput("test",T);
run;
%put &=test.;
Is there a way to only resolve only once? The NR function seems to remove the meaning of all &
and prevent any resolutions. I only want it to be resolved once.
The following example works but I need it to be part of a data step as there are several other regex functions that are being used to create the A&A
string.
%let Test=%NRSTR(A&A);
%put &test;
Any ideas?
In the DATA step single quote the text value that is being sent to the macro environment.
To prevent the &
from being interpreted as a resolution request, %superq
the macro symbol when using it.
Data _NULL_;
T = 'A&A';
call symput("test",T);
run;
%put NOTE: test macro symbol value is %superq(test);
---------- LOG ----------
21 %put NOTE: test macro symbol value is %superq(test);
NOTE: test macro symbol value is A&A