Tips:Macro Parameter Values using parmbuff & syspbuff

From sasCommunity
Jump to: navigation, search

Using the PARMBUFF option and SYSPBUFF, you can define a macro that accepts a varying number of parameters at each invocation.

SYSPBUFF resolves to the text supplied as parameter values in the invocation of a macro that is defined with the PARMBUFF option.

%macro print/parmbuff;
    %put macro contains : &syspbuff;
    %let cnt = %sysfunc(countw(&syspbuff));
    %do i = 1 %to &cnt;
        %let print = %scan(&syspbuff, &i);
    %end;
%mend print;                                                                                                                            
 
%print(blue, red, yellow);

OUTPUT 
macro contains : (blue,red,yellow)
Submitted By Chithra Mohan