The SAS Output Delivery System and reporting techniques

How do you remove blanked row headings in a TABULATE report?

Reply
SAS Employee
Posts: 174

How do you remove blanked row headings in a TABULATE report?

You may have noticed that TABULATE treats blanked headers differently depending on whether they're column headers or row headers. When you blank a column header (by assigning the label '' or ' ' to it), the header is removed from the table. This is what you want to happen typically.

However, when you blank a row header, it is not removed from the table. Rather it renders as an empty (text-less) header. This is not what you want to happen typically. Why clutter up an otherwise perfectly good table with empty headers?

How can you tell TABULATE to remove the blanked row headers? The answer is to use the TABLE statement ROW= option. Here is an example that demonstrates the default behavior (ROW=CONSTANT) compared to the ROW=FLOAT behavior.
[pre]
40 +title 'Product Sales';
41 +proc tabulate data=sashelp.prdsal2;
42 + class prodtype;
43 + var actual;
44 + table prodtype*actual=' ',sum mean;
45 + run;



Product Sales

---------------------------------------------
| | Sum | Mean |
|-----------------+------------+------------|
|Product | | | |
|Type | | | |
|--------+--------| | |
|FURNITU-| | | |
|RE | | 7594439.70| 659.24|
|--------+--------+------------+------------|
|OFFICE | | 7413742.62| 643.55|
---------------------------------------------
NOTE: There were 23040 observations read from the data set SASHELP.PRDSAL2.
NOTE: PROCEDURE TABULATE used (Total process time):
real time 0.84 seconds
cpu time 0.07 seconds

46 +
47 +proc tabulate data=sashelp.prdsal2;
48 + class prodtype;
49 + var actual;
50 + table prodtype*actual=' ',sum mean/row=float;
51 + run;



Product Sales

---------------------------------------------
| | Sum | Mean |
|-----------------+------------+------------|
|Product Type | | |
|-----------------| | |
|FURNITURE | 7594439.70| 659.24|
|-----------------+------------+------------|
|OFFICE | 7413742.62| 643.55|
---------------------------------------------
NOTE: There were 23040 observations read from the data set SASHELP.PRDSAL2.
NOTE: PROCEDURE TABULATE used (Total process time):
real time 0.78 seconds
cpu time 0.03 seconds
[/pre]
You may be asking yourself "Why isn't ROW=FLOAT the default behavior?" I can't answer that question with certainty. My guess is that it's for compatibility between the early versions of SAS that supported TABULATE.

-- David Kelley, SAS
Ask a Question
Discussion stats
  • 0 replies
  • 162 views
  • 0 likes
  • 1 in conversation