Wednesday, April 21, 2010

Re: Resolve a macro variable within single quotes

Frankly, it is a dup with new SAS sample code at http://support.sas.com/kb/25/076.html.
However, the sample looks not good. It seems that the author do not know exactly the macro quoting functions (%str, %nrbquote, and etc.).

With the code at below, the reader can get the meaning of macro quoting better.

%let name=Fred;

/* resolve the MV at compilation time */
%put %str(%'&name%');

/* resolve the MV at execution time */
/* Please use %nrbquote or %bquote, NOT %quote. */
%put %unquote(%nrbquote('&a'));

No comments: