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'));

Thursday, April 1, 2010

Special permanent libraries: USER/LIBRARY

We all know that SAS has two kinds of library: permanent library and temporary WORK library. However, do you know that there are still two special permanent libraries?

USER:
When it exists, all datasets reference with a one level name will be written to the the permanent USER library instead of the temporary WORK library.

For the convenience of debugging, I suggest we can miss "WORK." when reference dataset.

Note: system option USER has the same effect.

LIBRARY:
In FMTSEARCH, there are ALWAYS two implicit format catalogs: WORK.FORMATS and LIBRARY.FORMATS. If they do not appear in FMTSEARCH= list, they will be searched at first.