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 |
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.