Procedure features: |
PROC
TABULATE statement options:
|
TABLE statement:
|
ALL class variable |
|
COLPCTSUM statistic |
|
concatenation (blank) operator |
|
crossing (*)
operator |
|
format modifiers |
|
grouping elements (parentheses) operator |
|
labels |
|
REPPCTSUM
statistic |
|
ROWPCTSUM statistic |
|
variable list | |
|
Other features: |
FORMAT procedure
|
This example shows how to use three percentage sum statistics: COLPCTSUM,
REPPCTSUM, and ROWPCTSUM.
|
options nodate pageno=1 linesize=105 pagesize=60; |
|
data fundrais;
length name $ 8 classrm $ 1;
input @1 team $ @8 classrm $ @10 name $
@19 pencils @23 tablets;
sales=pencils + tablets;
datalines;
BLUE A ANN 4 8
RED A MARY 5 10
GREEN A JOHN 6 4
RED A BOB 2 3
BLUE B FRED 6 8
GREEN B LOUISE 12 2
BLUE B ANNETTE . 9
RED B HENRY 8 10
GREEN A ANDREW 3 5
RED A SAMUEL 12 10
BLUE A LINDA 7 12
GREEN A SARA 4 .
BLUE B MARTIN 9 13
RED B MATTHEW 7 6
GREEN B BETH 15 10
RED B LAURA 4 3
; |
|
proc format;
picture pctfmt low-high='009 %';
run; |
|
title "Fundraiser Sales"; |
|
proc tabulate format=7.; |
|
class team classrm; |
|
var sales; |
|
table (team all), |
|
classrm='Classroom'*sales=' '*(sum
colpctsum*f=pctfmt9.
rowpctsum*f=pctfmt9.
reppctsum*f=pctfmt9.)
all*sales*sum=' ' |
|
/rts=20;
run; |
Fundraiser Sales 1
--------------------------------------------------------------------------------------------------------
| | Classroom | |
| |---------------------------------------------------------------------------| |
| | A | B | All |
| |-------------------------------------+-------------------------------------+-------|
| | Sum |ColPctSum|RowPctSum|RepPctSum| Sum |ColPctSum|RowPctSum|RepPctSum| Sum |
|------------------+-------+---------+---------+---------+-------+---------+---------+---------+-------|
|team | | | | | | | | | |
|------------------| | | | | | | | | |
|BLUE | 31| 34 %| 46 %| 15 %| 36| 31 %| 53 %| 17 %| 67|
|------------------+-------+---------+---------+---------+-------+---------+---------+---------+-------|
|GREEN | 18| 19 %| 31 %| 8 %| 39| 34 %| 68 %| 19 %| 57|
|------------------+-------+---------+---------+---------+-------+---------+---------+---------+-------|
|RED | 42| 46 %| 52 %| 20 %| 38| 33 %| 47 %| 18 %| 80|
|------------------+-------+---------+---------+---------+-------+---------+---------+---------+-------|
|All | 91| 100 %| 44 %| 44 %| 113| 100 %| 55 %| 55 %| 204|
--------------------------------------------------------------------------------------------------------
Here are the percentage sum statistic calculations used to produce the
output for the Blue Team in Classroom A:
|
COLPCTSUM=31/91*100=34% |
|
ROWPCTSUM=31/67*100=46% |
|
REPPCTSUM=31/204*100=15% |
Similar calculations were
used to produce the output for the
remaining teams and classrooms.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.