Year:
,
followed by the value, is the page dimension text.'MAX'
).
proc format; value agefmt 0-29='Under 30' 30-39='30-39' 40-49='40-49' 50-59='50-59' 60-69='60-69' other='70 or over'; run;
The observations in
the input data set must be sorted by the BY variables. (footnote1)
|
|||
Use ALL in the page
dimension to create a report for all classes. (See Summarizing Information with the Universal Class Variable ALL.)
|
|||
The percentages in the
tables are percentages of the total for that BY group. You cannot
calculate percentages for a BY group compared to the totals for all
BY groups because PROC TABULATE prepares the individual reports separately.
Data for the report for one BY group are not available to the report
for another BY group.
|
You can use denominator
definitions to control the meaning of PCTN. (See Calculating Percentages .)
|
||
You can use the #BYVAL,
#BYVAR, and #BYLINE specifications in TITLE statements to customize
the titles for each BY group. (See Creating Titles That Contain BY-Group Information .)
|
|||
proc tabulate data=energy; class division type; table division* (n='Number of customers' pctn<type>='% of row' 1 pctn<division>='% of column' 2 pctn='% of all customers'), 3 type/rts=50; title 'Number of Users in Each Division'; run;
1 | <type> sums
the frequency counts for all occurrences of Type within the same value
of Division. Thus, for Division=1, the denominator is 6 + 6, or 12.
|
2 | <division> sums
the frequency counts for all occurrences of Division within the same
value of Type. Thus, for Type=1, the denominator is 6 + 3 + 8 + 5,
or 22.
|
3 | The third use of PCTN has no denominator definition. Omitting a denominator definition is the same as including all class variables in the denominator definition. Thus, for all cells, the denominator is 6 + 3 + 8 + 5 + 6 + 3 + 8 + 5, or 44. |
proc tabulate data=energy format=8.2; class division type; var expenditures; table division* (sum='Expenditures'*f=dollar10.2 pctsum<type>='% of row' 1 pctsum<division>='% of column' 2 pctsum='% of all customers'), 3 type*expenditures/rts=40; title 'Expenditures in Each Division'; run;
1 | <type> sums
the values of Expenditures for all occurrences of Type within the
same value of Division. Thus, for Division=1, the denominator is $7,477
+ $5,129.
|
2 | <division> sums
the frequency counts for all occurrences of Division within the same
value of Type. Thus, for Type=1, the denominator is $7,477 + $19,379
+ $5,476 + $13,959.
|
3 | The third use of PCTN has no denominator definition. Omitting a denominator definition is the same as including all class variables in the denominator definition. Thus, for all cells, the denominator is $7,477 + $19,379 + $5,476 + $13,959 + $5,129 + $15,078 + $4,729 + $12,619. |
proc format;
value expfmt low-<10000='red'
10000-<20000='yellow'
20000-high='green';
run;
ods html body='external-HTML-file';
proc tabulate data=energy style=[backgroundcolor=expfmt.];
class region division type;
var expenditures;
table (region all)*(division all),
type*expenditures;
run;
ods html close;