Procedure features: |
PROC
TABULATE statement option:
|
CLASS statement options:
|
TABLE statement option:
|
|
Other features: |
PRINT procedure
|
Data set: |
ENERGY
|
Formats: |
REGFMT., DIVFMT., and USETYPE.
|
This example
-
creates a table that includes all possible combinations
of formatted class variable values (PRELOADFMT with PRINTMISS), even if those
combinations have a zero frequency and even if they do not make sense
-
uses only the preloaded range of user-defined
formats as the levels of class variables (PRELOADFMT with EXCLUSIVE).
-
writes the output to an output data set, and prints
that data set.
|
options nodate pageno=1 linesize=80 pagesize=60; |
|
proc tabulate data=energy format=dollar12.; |
|
class region division type / preloadfmt; |
|
var expenditures; |
|
table region*division,
type*expenditures / rts=25 printmiss; |
|
format region regfmt. division divfmt. type usetype.; |
|
title 'Energy Expenditures for Each Region';
title2 '(millions of dollars)';
run; |
|
proc tabulate data=energy format=dollar12. out=tabdata; |
|
class region division type / preloadfmt exclusive; |
|
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; |
|
proc print data=tabdata;
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|
| |-----------+------------+------------|
| |Mountain | .| .|
| |-----------+------------+------------|
| |Pacific | .| .|
|-----------+-----------+------------+------------|
|South |New England| .| .|
| |-----------+------------+------------|
| |Middle | | |
| |Atlantic | .| .|
| |-----------+------------+------------|
| |Mountain | .| .|
| |-----------+------------+------------|
| |Pacific | .| .|
|-----------+-----------+------------+------------|
|Midwest |New England| .| .|
| |-----------+------------+------------|
| |Middle | | |
| |Atlantic | .| .|
| |-----------+------------+------------|
| |Mountain | .| .|
| |-----------+------------+------------|
| |Pacific | .| .|
|-----------+-----------+------------+------------|
|West |New England| .| .|
| |-----------+------------+------------|
| |Middle | | |
| |Atlantic | .| .|
| |-----------+------------+------------|
| |Mountain | $5,476| $4,729|
| |-----------+------------+------------|
| |Pacific | $13,959| $12,619|
---------------------------------------------------
Energy Expenditures for Each Region 2
(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|
---------------------------------------------------
3
E
x
p
e
n
d
i
t
D u
i _ r
R v _ _ T e
e i T P A s
g s T Y A B _
O i i y P G L S
b o o p E E E u
s n n e _ _ _ m
1 Northeast New England Residential Customers 111 1 1 7477
2 Northeast New England Business Customers 111 1 1 5129
3 Northeast Middle Atlantic Residential Customers 111 1 1 19379
4 Northeast Middle Atlantic Business Customers 111 1 1 15078
5 West Mountain Residential Customers 111 1 1 5476
6 West Mountain Business Customers 111 1 1 4729
7 West Pacific Residential Customers 111 1 1 13959
8 West Pacific Business Customers 111 1 1 12619
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.