Previous Page | Next Page

The TABULATE Procedure

Example 6: Summarizing Information with the Universal Class Variable ALL


Procedure features:

PROC TABULATE statement options:

FORMAT=

TABLE statement:

ALL class variable

concatenation (blank operator)

format modifiers

grouping elements (parentheses operator)

Data set: ENERGY
Formats: REGFMT., DIVFMT., and USETYPE.

This example shows how to use the universal class variable ALL to summarize information from multiple categories.


Program

 Note about code
options nodate pageno=1 linesize=64 pagesize=60;
 Note about code
proc tabulate data=energy format=comma12.;
 Note about code
   class region division type;
 Note about code
   var expenditures;
 Note about code
table region*(division all='Subtotal')
         all='Total for All Regions'*f=dollar12.,
 Note about code
         type='Customer Base'*expenditures=' '*sum=' '
         all='All Customers'*expenditures=' '*sum=' '
 Note about code
      / rts=25;
 Note about code
   format region regfmt. division divfmt. type usetype.;
 Note about code
   title 'Energy Expenditures for Each Region';
   title2 '(millions of dollars)';
run;

Output

 Note about figure
              Energy Expenditures for Each Region              1
                     (millions of dollars)

----------------------------------------------------------------
|                       |      Customer Base      |            |
|                       |-------------------------|            |
|                       |Residential |  Business  |    All     |
|                       | Customers  | Customers  | Customers  |
|-----------------------+------------+------------+------------|
|Region     |Division   |            |            |            |
|-----------+-----------|            |            |            |
|Northeast  |New England|       7,477|       5,129|      12,606|
|           |-----------+------------+------------+------------|
|           |Middle     |            |            |            |
|           |Atlantic   |      19,379|      15,078|      34,457|
|           |-----------+------------+------------+------------|
|           |Subtotal   |      26,856|      20,207|      47,063|
|-----------+-----------+------------+------------+------------|
|West       |Division   |            |            |            |
|           |-----------|            |            |            |
|           |Mountain   |       5,476|       4,729|      10,205|
|           |-----------+------------+------------+------------|
|           |Pacific    |      13,959|      12,619|      26,578|
|           |-----------+------------+------------+------------|
|           |Subtotal   |      19,435|      17,348|      36,783|
|-----------------------+------------+------------+------------|
|Total for All Regions  |     $46,291|     $37,555|     $83,846|
----------------------------------------------------------------

Previous Page | Next Page | Top of Page