我试图制作以下两个工作表" woe_con_out"和" woe_cat_out"进入同一个excel" woe_summary.xlsx"。但是在运行此代码之后,只生成了一个工作表(woe_cat_out)。我哪里做错了?
data translate;
format report $256.;
infile "out_con.out" dlm='09'x dsd;
input report $;
run;
ods excel file="woe_summary.xlsx" style = printer options(sheet_name = "woe_con_out") ;
proc print data = translate noobs
style(data) = {font_face = "courier_new" font_size = 11pt}
style(column) = {width = 1000%};
run;
ods excel close;
data translate;
format report $256.;
infile "out_cat.out" dlm='09'x dsd;
input report $;
run;
ods excel file="woe_summary.xlsx" style = printer options(sheet_name = "woe_cat_out") ;
proc print data = translate noobs
style(data) = {font_face = "courier_new" font_size = 11pt}
style(column) = {width = 1000%};
run;
ods excel close;
答案 0 :(得分:2)
对于每个ods excel options
语句,您需要proc print
个语句:
/* first ods excel statement includes the file and style */
ods excel file="C:\desktop\woe_summary.xlsx" style = printer;
/* include ods excel options sheet_name for each PROC PRINT statement */
ods excel options(sheet_name = "woe_con_out");
proc print data = sashelp.class noobs;
var _all_;
run;
/* same as above -- include ods excel options sheet_name for each PROC PRINT statement */
ods excel options(sheet_name = "woe_cat_out");
proc print data = sashelp.fish noobs;
var _all_;
run;
/* close your ods excel engine */
ods excel close;
此外,在您的情况下,我会创建两个translate
数据集,即translate_con
和translate_cat
,因此您不会覆盖它们并能够使用所述方法。