Help using Base SAS procedures

How to suppress the 'blank' column in Proc Tabulate?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

How to suppress the 'blank' column in Proc Tabulate?

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!


Accepted Solutions
Solution
‎07-07-2015 01:40 PM
SAS Super FREQ
Posts: 8,743

Re: How to suppress the 'blank' column in Proc Tabulate?

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

View solution in original post


All Replies
PROC Star
Posts: 1,562

Re: How to suppress the 'blank' column in Proc Tabulate?

Deleted as I was wrong. Thanks Cynthia!

Super User
Posts: 10,504

Re: How to suppress the 'blank' column in Proc Tabulate?

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.

Solution
‎07-07-2015 01:40 PM
SAS Super FREQ
Posts: 8,743

Re: How to suppress the 'blank' column in Proc Tabulate?

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

Occasional Contributor
Posts: 13

Re: How to suppress the 'blank' column in Proc Tabulate?

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.

Occasional Contributor
Posts: 13

Re: How to suppress the 'blank' column in Proc Tabulate?

Is it possible to get an output like this?

group
AB
number
N33
Mean25
Median25

Instead of following two:

group
AB
numberN33
Mean25
Median2

5

OR

group
AB
number33
25
25
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 919 views
  • 0 likes
  • 4 in conversation