Previous Page | Next Page

The TABULATE Procedure

Example 1: Creating a Basic Two-Dimensional Table


Procedure features:

PROC TABULATE statement options:

FORMAT=

TABLE statement

crossing (*) operator

TABLE statement options:

RTS=

Other features: FORMAT statement

The following example program


Program

 Note about code
data energy;
   length State $2;
   input Region Division state $ Type Expenditures;
   datalines;
1 1 ME 1 708
1 1 ME 2 379
 
. . . more data lines . . . 
 
4 4 HI 1 273
4 4 HI 2 298
;
 Note about code
proc format;
   value regfmt 1='Northeast'
                2='South'
                3='Midwest'
                4='West';
   value divfmt 1='New England'
                2='Middle Atlantic'
                3='Mountain'
                4='Pacific';
   value usetype 1='Residential Customers'
                 2='Business Customers';
run;
 Note about code
options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
proc tabulate data=energy format=dollar12.;
 Note about code
   class region division type;
   
 Note about code
   var expenditures;
 Note about code
    table region*division,
          type*expenditures
 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

                      Energy Expenditures for Each Region                      1
                             (millions of dollars)

              ---------------------------------------------------
              |                       |          Type           |
              |                       |-------------------------|
              |                       |Residential |  Business  |
              |                       | Customers  | Customers  |
              |                       |------------+------------|
              |                       |Expenditures|Expenditures|
              |                       |------------+------------|
              |                       |    Sum     |    Sum     |
              |-----------------------+------------+------------|
              |Region     |Division   |            |            |
              |-----------+-----------|            |            |
              |Northeast  |New England|      $7,477|      $5,129|
              |           |-----------+------------+------------|
              |           |Middle     |            |            |
              |           |Atlantic   |     $19,379|     $15,078|
              |-----------+-----------+------------+------------|
              |West       |Mountain   |      $5,476|      $4,729|
              |           |-----------+------------+------------|
              |           |Pacific    |     $13,959|     $12,619|
              ---------------------------------------------------

Previous Page | Next Page | Top of Page