Previous Page | Next Page

Automatic Macro Variables

SYSPBUFF Automatic Macro Variable



Contains text supplied as macro parameter values.
Type: Automatic macro variable (read and write, local scope)

Details
Example
Using SYSPBUFF to Display Macro Parameter Values

Details

SYSPBUFF resolves to the text supplied as parameter values in the invocation of a macro that is defined with the PARMBUFF option. For name-style invocations, this text includes the parentheses and commas. Using the PARMBUFF option and SYSPBUFF, you can define a macro that accepts a varying number of parameters at each invocation.

If the macro definition includes both a set of parameters and the PARMBUFF option, the macro invocation causes the parameters to receive values and the entire invocation list of values to be assigned to SYSPBUFF.


Example


Example 1: Using SYSPBUFF to Display Macro Parameter Values

The macro PRINTZ uses the PARMBUFF option to define a varying number of parameters and SYSPBUFF to display the parameters specified at invocation.

%macro printz/parmbuff;
   %put Syspbuff contains: &syspbuff;
   %let num=1;
   %let dsname=%scan(&syspbuff,&num);
   %do %while(&dsname ne);
      proc print data=&dsname;
      run;
      %let num=%eval(&num+1);
      %let dsname=%scan(&syspbuff,&num);
   %end;
%mend printz;

%printz(purple,red,blue,teal)

When this program executes, this line is written to the SAS log:

Syspbuff contains: (purple,red,blue,teal)

Previous Page | Next Page | Top of Page