data test;
input group $ number;
datalines;
A 1
A 2
A 3
B 4
B 5
B 6
;
run;
ods html file = '..\test.xls';
proc tabulate;
var number;
class group;
tables number*(n mean median), group;
run;
proc tabulate;
var number;
class group;
tables number*(n='' mean='' median=''), group;
run;
ods html close;
The first proc tabulate inserts a column in Excel file with the name of the statistic (m mean median), while the second proc tabulate blanks those names, however, the column still remains. Is there a way to remove that column from the output?
Thanks!
Hi:
When you blank out statistic names in the row dimension with TABULATE, you can use ROW=FLOAT to remove/suppress the empty row header area for the statistic names:
tables number*(n='' mean='' median=''), group /row=float;
...if you add this table option to your 2nd TABULATE step, that should get rid of the statistic names. However, I would expect that the people using the report might find it confusing to know which row is the N, which the MEAN and which the MEDIAN if you suppress that information.
The documentation example that explains the behavior is here: Base SAS(R) 9.4 Procedures Guide, Third Edition, but you will see that they are only suppressing 1 statistic name (SUM), which is the ONLY statistic used in the example.
Here's a Tech Support note about it: 22751 - I am blanking out a statistic in my row dimension and the label is blank but the space has r... and here's another: 498 - The ROW=FLOAT option has no effect on the files created with ODS HTML,PRINTER or RTF (this behavior changed in SAS 9.1).
cynthia
Deleted as I was wrong. Thanks Cynthia!
You may want to provide what you want the table to look like. To suppress a column then don't ask for it. If you ask for N as a statistic you will get a column for it, if you don't want the column remove the statistic.
Hi:
When you blank out statistic names in the row dimension with TABULATE, you can use ROW=FLOAT to remove/suppress the empty row header area for the statistic names:
tables number*(n='' mean='' median=''), group /row=float;
...if you add this table option to your 2nd TABULATE step, that should get rid of the statistic names. However, I would expect that the people using the report might find it confusing to know which row is the N, which the MEAN and which the MEDIAN if you suppress that information.
The documentation example that explains the behavior is here: Base SAS(R) 9.4 Procedures Guide, Third Edition, but you will see that they are only suppressing 1 statistic name (SUM), which is the ONLY statistic used in the example.
Here's a Tech Support note about it: 22751 - I am blanking out a statistic in my row dimension and the label is blank but the space has r... and here's another: 498 - The ROW=FLOAT option has no effect on the files created with ODS HTML,PRINTER or RTF (this behavior changed in SAS 9.1).
cynthia
Thanks, Cynthia! This is exactly what I was looking for.
Your doubt is valid, but the information regarding which row is N, Mean, etc. will be included within the Excel file that will be Output.
Is it possible to get an output like this?
group | ||
A | B | |
number | ||
N | 3 | 3 |
Mean | 2 | 5 |
Median | 2 | 5 |
Instead of following two:
group | |||
A | B | ||
number | N | 3 | 3 |
Mean | 2 | 5 | |
Median | 2 | 5 |
OR
group | ||
A | B | |
number | 3 | 3 |
2 | 5 | |
2 | 5 |
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.