Yes, the "mess" that is SAS macro quoting and the lack of obviousness that is choosing the right masking macro function. First there was %NR/STR, than %NR/QUOTE, after that %NR/BQUOTE was introduced, and at last %SUPER... And each one has one or more particular set of features, being: - Compile time, and runtime execution: Some operate at compile time, while the others only evaluate at runtime (nothing happens at compile time their treated as text). - percent and ampersand masking: Easy to identify, every* macro function starting with %NR will mask the % and & preventing the resolve of macro variables/functions. - unmatched single quotes, double quotes and parentheses masking: Actually all quoting functions are capable of masking unmatched single/double quotes and parentheses, but some mask them char by char while other do this by pair unless you explicitly identify the unmatched pairs prefixing the char with a percent sign (%). Every* functions starting with the form %NRB* or %B* do not need to identify unmatched pairs. * there's actually a macro quoting function that doesn't follow the rule, %SUPER, which (as the name says) is the super-mega-power-thing on macro quoting. So with that, and knowing that %STR is a compile time function and %NRBQUOTE is a runtime one. %STR will not mask percent and ampersand (no %NR prefix) and will require to identify unmatched pairs (no %B* prefix). %NRBQUOTE will mask percent and ampersand (%NR prefix) and will not require to identify unmatched pairs (%NRB* prefix). For your particular case, % and & masking is not need, and the moment of function evaluation is pretty much irrelevant (compile/runtime). So, since you have a single unmatched quote, it's pretty much a matter of choosing If you want to identify it or not. From there, you may choose one of three functions. %STR or %QUOTE, which both require the % before the single quote and differ only on execution time (compile/runtime). Or %BQUOTE, which will not require to identify the unmatched quote, and is evaluated at runtime. All suggestions above are correct, as they will solve VD's single quote problem. That being said... @Artur, %NRBQUOTE is actually more than it's needed as there is no & or % to mask, %BQUOTE is just enough. @Ksharp, for %STR there is no need to mask matched pairs(), just the unmatched single quote. Cheers from Portugal. Daniel Santos @ www.cgd.pt
... View more