SAS回归结果输出到excel合sheet

SAS regression result output to excel in one sheet

我想将我的 SAS 回归结果输出到 excel。
代码是:

proc import datafile = 'cmds.csv'
out = Work.cmds
dbms = CSV;
run; 

ODS TAGSETS.EXCELXP 
file="dt.xls";
STYLE = STATISTICAL;

proc sort data=Work.Cmds out=Work.Cmds;
by year;
run;

proc reg data=Work.Cmds outest=want tableout;
by year;
model Investment = Size Growth_New Leverage complex Deficit pc_income_NEW Density/hcc adjrsq ;
ods output parameterestimates=want2;
run;

ODS TAGSETS.EXCELXP CLOSE;

虽然成功生成了excel文件,但是里面包含了很多sheet。我想在一个 sheet 中生成所有东西。我该怎么办?

标签集中有选项,特别是 sheet_interval。要全部转到一页,请将 sheet 间隔选项设置为 none。

ODS TAGSETS.EXCELXP file="dt.xls" STYLE = STATISTICAL options (sheet_interval='none');

但是,TAGSETS.EXCELXP 生成一个 XML 文件,而不是 Excel 文件。如果您有 SAS 9.4 TS1M4+,那么我会推荐 ODS EXCEL。

ods excel file="dt.xlsx" style=statistical options (sheet_interval = 'none');

ODS TAGSETS.EXCELXP 的所有选项列表在这里: https://support.sas.com/rnd/base/ods/odsmarkup/excelxp_help.html

将生成单个选项卡的完整示例:

ods tagsets.excelxp file='C:\_localdata\demo.xls' options(sheet_interval='none');
proc sort data=sashelp.cars out=cars;
by origin;
run;

proc reg data=cars outest=demo tableout;
by origin;
model mpg_city = mpg_highway invoice cylinders;
ods output parameterEstimates=want;
run;

ods tagsets.excelxp close;