## Fitting Proc Means to one excel worksheet

Solved
Frequent Contributor
Posts: 129

# Fitting Proc Means to one excel worksheet

Hi All,

I have a proc means that creates multiple tables. I use ODS Excel to export it to excel.

When it exports it creates a new tab for each table and I would like all the tables to appear on one worksheet.

Or ultimately If I can actually have all the data appear in one table.

``````Proc means data=work.acw_abs_baseline median Mean q1 q3 stddev;
By Cluster Queue_cd;
VAR AWT;
Format AWT Comma9.0;
Run;``````

Current ouput

 Cluster=ABS Queue Code=ABSa The MEANS Procedure Analysis Variable : AWT Median Mean LowerQuartile UpperQuartile Std Dev 107.3750000 138.5862480 58.7692308 174.2857143 142.0509725

Like the Output to look like this?

 Analysis Variable : AWT Cluster Code Median Mean LowerQuartile UpperQuartile Std Dev ABS ABSa 107.3750000 138.5862480 58.7692308 174.2857143 142.0509725 ABS ABSb 67.0000000 121.4754246 17.6666667 143.0000000 275.3427533 DSC DSCa 251.0000000 327.7871022 134.0000000 421.5000000 329.8855516 DSC DSCb 226.3333333 288.4081027 114.0000000 387.0000000 278.9890103

Cheers

Dean

Accepted Solutions
Solution
‎09-13-2017 10:30 PM
Super User
Posts: 24,010

## Re: Fitting Proc Means to one excel worksheet

1. Use ODS EXCEL with the SHEET_INTERVAL='none' option to have all the results on one table.

2. To get a 'simplified' table, run PROC MEANS using the STACKODS option - capture the table and then use PROC PRINT to export the results to your excel file using ODS EXCEL.

You can either do it before the ODS EXCEL to avoid duplicate output or use ods exclude all to suppress the results.

See an example of the STACKODS options here:

http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf9...

All Replies
Solution
‎09-13-2017 10:30 PM
Super User
Posts: 24,010

## Re: Fitting Proc Means to one excel worksheet

1. Use ODS EXCEL with the SHEET_INTERVAL='none' option to have all the results on one table.

2. To get a 'simplified' table, run PROC MEANS using the STACKODS option - capture the table and then use PROC PRINT to export the results to your excel file using ODS EXCEL.

You can either do it before the ODS EXCEL to avoid duplicate output or use ods exclude all to suppress the results.

See an example of the STACKODS options here:

http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf9...

PROC Star
Posts: 1,334

## Re: Fitting Proc Means to one excel worksheet

Another option: Use the CLASS statement in PROC MEANS...

```proc means data=sashelp.class median Mean q1 q3 stddev nway;
class name sex;
var height;
run;```
Frequent Contributor
Posts: 129

## Re: Fitting Proc Means to one excel worksheet

Thanks Tom for your help again.

Cheers

Dean

☑ This topic is solved.