Procedure features: |
PROC TABULATE
statement options:
|
TABLE statement
|
TABLE statement options:
|
|
Other features: |
FORMAT statement
|
The following example program
-
creates a category for each type
of user (residential
or business) in each division of each region
-
applies the same format to all cells in the table
-
applies a format to
each class variable
-
extends the space for row headings.
|
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
; |
|
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; |
|
options nodate pageno=1 linesize=80 pagesize=60; |
|
proc tabulate data=energy format=dollar12.; |
|
class region division type;
|
|
var expenditures; |
|
table region*division,
type*expenditures |
|
/ rts=25; |
|
format region regfmt. division divfmt. type usetype.; |
|
title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
run; |
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|
---------------------------------------------------
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.