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
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.
Output 48.1 shows a simple table that was produced by PROC TABULATE. The data set ENERGY on page 1401 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 headers without hyphenating them.)
options nodate pageno=1 linesize=64 pagesize=40; proc tabulate data=energy; class region division type; var expenditures; table region*division, type*expenditures / rts=20; run;
The SAS System 1 ---------------------------------------------- Type ------------------------- 1 2 ------------+------------ ExpendituresExpenditures ------------+------------ Sum Sum ------------------+------------+------------ Region Division --------+--------- 1 1 7477.00 5129.00 ---------+------------+------------ 2 19379.00 15078.00 --------+---------+------------+------------ 4 3 5476.00 4729.00 ---------+------------+------------ 4 13959.00 12619.00 ----------------------------------------------
Output 48.2 is a more complicated table using the same data set that was used to create Output 48.1. The statements that create this report
customize column and row headers
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 Example 6 on page 1260.
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 ,291 ,555 ,846 ----------------------------------------------------------------
Display 48.1 on page 1197 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 Example 14 on page 1293.