My goal is to pass percent symbols into a string.
There is no result to the %put when I run:
%let foo = %nrstr(bar%x%);
%put foo is &foo;
If run again, I get errors, the first one is
WARNING: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks."
In Enterprise Guide, the parenthesis matcher doesn't detect the close parenthesis.
Adding another close parenthesis:
%let foo = %nrstr(bar%x%));
results:
foo is bar%x)
%nrstr will pass unbalanced parenthesis into the result, so this isn't surprising. This would seem to imply that the snippet with just the open and close parenthesis are balanced.
The percent symbol before the close parenthesis was causing the unexpected behavior.
Per SAS(R) 9.2 Macro Language: Reference:
percent sign before a parenthesis - for example, %( or %) two percent signs (%%): EXAMPLE: %let x=%str(20%%);
making the correct code:
%let foo = %nrstr(bar%x%%);
%put foo is &foo;
resulting in:
foo is bar%x%