%macro repeat(num=,style=,num1=);
data _null_;
num=&num.;
%if %length(&num1.)>0 %then %do; num1=&num1.; %end;
%else %do; num1=&num.; %end;
styles=substr(cats(repeat("&style.",num1-1),repeat("c",num-1)),1,num);
call symput("styles",strip(styles));
run;
%put ### styles=&styles.;
%mend;
%repeat(num=5, style=l, num1=);
%repeat(num=5, style=c, num1=);
%repeat(num=5, style=l, num1=2);
%repeat(num=5, style=l, num1=3);
不知能否满足楼主的需求,仅供参考~