TABULATE Procedure

Overview: TABULATE Procedure

What Does the TABULATE Procedure Do?

The TABULATE procedure displays descriptive statistics in tabular format, using some or all of the variables in a data set. You can create a variety of tables ranging from simple to highly customized.
PROC TABULATE computes many of the same statistics that are computed by other descriptive statistical procedures such as MEANS, FREQ, and REPORT. PROC TABULATE provides the following features:
  • simple but powerful methods to create tabular reports
  • flexibility in classifying the values of variables and establishing hierarchical relationships between the variables
  • mechanisms for labeling and formatting variables and procedure-generated statistics

Simple Tables

The following output shows a simple table that was produced by PROC TABULATE. The data set ENERGY contains data on expenditures of energy by two types of customers, residential and business, in individual states in the Northeast (1) and West (4) regions of the United States. The table sums expenditures for states within a geographic division. The RTS option provides enough space to display the column headings without hyphenating them.)
proc tabulate data=energy;
   class region division type;
   var expenditures;
   table region*division, type*expenditures /
         rts=20;
run;
Simple Table Produced by PROC TABULATE
The SAS System

Complex Tables

The following output is a more complicated table using the same data set that was used to create Simple Table Produced by PROC TABULATE. The statements that create this report do the following:
  • customize column and row headings
  • apply a format to all table cells
  • sum expenditures for residential and business customers
  • compute subtotals for each division
  • compute totals for all regions
For an explanation of the program that produces this report, see Summarizing Information with the Universal Class Variable ALL.
Complex Table Produced by PROC TABULATE
             Energy Expenditures for Each Region              2
                     (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|
----------------------------------------------------------------

PROC TABULATE and the Output Delivery System

The following display shows a table that is created in Hypertext Markup Language (HTML). You can use the Output Delivery System with PROC TABULATE to create customized output in HTML, Rich Text Format (RTF), Portable Document Format (PDF), and other output formats. For an explanation of the program that produces this table, see Specifying Style Elements for ODS Output.
HTML Table Produced by PROC TABULATE
Energy Expenditures