The macro functions %SYSFUNC
and %QSYSFUNC can call most DATA step functions to generate text in
the macro facility. %SYSFUNC and %QSYSFUNC have one difference: %QSYSFUNC
masks special characters and mnemonics and %SYSFUNC does not. For
more information about these functions, see %QSYSFUNC and %SYSFUNC
in
SAS Macro Language: Reference.
%SYSFUNC arguments are
a single DATA step function and an optional format, as shown in the
following examples:
%sysfunc(date(),worddate.)
%sysfunc(attrn(&dsid,NOBS))
You cannot nest DATA
step functions within %SYSFUNC. However, you can nest %SYSFUNC functions
that call DATA step functions. For example:
%sysfunc(compress(%sysfunc(getoption(sasautos)),
%str(%)%(%')));
All arguments in DATA
step functions within %SYSFUNC must be separated by commas. You cannot
use argument lists that are preceded by the word OF.
Because %SYSFUNC is
a macro function, you do not need to enclose character values in quotation
marks as you do in DATA step functions. For example, the arguments
to the OPEN function are enclosed in quotation marks when you use
the function alone, but the arguments do not require quotation marks
when used within %SYSFUNC.
dsid=open("sasuser.houses","i");
dsid=open("&mydata","&mode");
%let dsid=%sysfunc(open(sasuser.houses,i));
%let dsid=%sysfunc(open(&mydata,&mode));