SAS循环列名画图放入多Sheet中 %macro loop(DSin); proc sql noprint; select distinct name into :Var1-:Var999 from dictionary.columns where libname = "%upcase(%scan(&DSin,1,'.'))" and memname = "%upcase(%scan(&DSin,2,'.'))"; quit; ods excel file="&add\boxplot.xlsx" options(embedded_titles="yes" contents="yes" ); %local i; %do i=1 %to &sqlobs; ods Excel OPTIONS (sheet_name="&&Var&i"); ods proclabel= "&&Var&i"; %hello(&&Var&i); %end; ods excel close; %mend; %macro hello(vars); PROC SGPLOT DATA= kbbl.ys; VBOX &vars. ; RUN; %mend;