1
votes

I'm trying to export a content to Excel. I use the below code but my output excel formatting is horrible.

ods excel file= "&cur_path/&project_name._Proc_Means.xlsx" style=printer ; proc means data=&this_lib..&this_data; run; ods excel close;

The output looks like

enter image description here

The huge blank gap makes the file unreadable. I also find out that it puts all the outputs in the same row instead of many different rows.

Any suggestions on how to fix it?

Thanks in advance.

1

1 Answers

1
votes

Assuming you have SAS 9.3+, which you must to use ODS EXCEL, you can add the stackodsoutput option to the PROC MEANS statement; that will give you a much more nicely formatted sheet.

ods excel file= "c:\temp\Proc_Means.xlsx" style=printer ;
proc means data=sashelp.cars stackodsoutput;
run;
ods excel close;

If you have prior to 9.3, you may want to use the OUT= option in PROC MEANS and then output the dataset yourself using PROC EXPORT or PROC PRINT. The default PROC MEANS ODS output is not very table-friendly.