| Date: | Thu, 21 Oct 2004 14:35:38 -0400 |
| Reply-To: | bill_droogendyk@DOFASCO.CA |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Bill Droogendyk <bill_droogendyk@DOFASCO.CA> |
| Subject: | Re: Tabulate Pecentage Issues |
|
| Content-Type: | text/plain; charset="us-ascii" |
Gerry:
you need to include a denominator definition in the table statement -
also on page 94ff.
If i've understood the specification properly, this should do it;
Table MAJOR,(ETHNIC*SEX ALL),
RCDE*(N PctN<ethnic*sex all>*f=8.2) ALL /
MissText=' ' Box=_PAGE_ ;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Gerry
Sent: 21 October, 2004 12:59
To: SAS-L@LISTSERV.UGA.EDU
Subject: Tabulate Pecentage Issues
SAS Pros:
First, I apologize for the length of this note, but I needed to include
enough data with the code to provide a valid example of the "problem".
My concern is with computing the percentages (N, PctN) correctly -- I'm
either missing something very obvious, or mis-understanding on how the
perecentages are computed. If it's not already apparent, I'm a very
infrequent user of PROC TABULATE.
What I, or more precisely, our client, wants is the percentage for
gender
(SEX) for each ethnicity code (ETHNIC) by Residency Code (RCDE) in the
example below.
What is desired is somewhat similar to the example on page 94 of the v6
"SAS Guide to Tabulate Processing" (I have more dimensions). I'm using
SAS v8.2 on the mainframe and v9 on the PC; both produce the same
results.
Any help and guidence will be very much appreciated !
Thank you.
-Gerry
Gerard T. Pauline
Mgr, Internet Applications &
University WebMaster
Computer Systems, DoIT
Pace University
=======================================================================
====
==================
Data ISIS ;
Input @1 MAJOR $3. @5 SEX $1. @7 ETHNIC $1. @9 RCDE $1. ; DataLines ;
CM M 2 D BCH F 2 B BCH F 1 C
LS F T
EVS F 2 A
CM F 3 T
CM F 5 T
LS F 5 S
LS F 3 E
BCH M 2 C
LS F 5 C
CM F 1 D
CM F 1 D
CM F 2 T
BCH F 3 N
CM G
EVS M 2 D
BCH F 3 C
CM F 1 C
CM F A
CM F 5 I
LS F 3 I
EVS M 5 C
CM M C
BCH F 1 D
LS F 3 B
LS F J
BCH F 3 C
CM M 3 A
BCH M 5 E
BCH F B
CM M A
LS M I
EVS F 2 C
LS F 3 C
BCH F 5 C
LS F 5 E
CM M 3 C
CM F 1 B
CM F D
LS F 5 A
BCH F 5 C
COM F 1 C
BCH F 1 C
EVS F 1 C
CM F 1 A
BCH M 2 C
LS M 3 G
CM F 5 G
EVS F 5 C
BCH F 5 C
EVS M 1 C
CM F 1 B
COM F C
CM M 2 D
CM F 3 A
CM F 1 C
EVS M 5 D
BCH F 5 D
BCH M 5 P
COM F 5 N
CM F D
EVS M 5 P
CM M R
CM F 3 C
CM M 3 C
CM F 5 C
EVS F 5 R
LS M 1 A
LS F 5 C
CM M 1 A
LS M C
BCH F 5 A
COM F 3 G
EVS F 5 T
CM F 5 A
;
Proc FORMAT ;
Value $ETH '1' = 'Black Non-Hispanic'
'2' = 'Asian Or Pacific Islander'
'3' = 'Hispanic'
'4' = 'American Indian - Alaskannat'
'5' = 'White / Non-Hispanic'
'6' = 'Other'
'7' = 'No Data In ISIS' ;
Value $SEX 'F' = 'Female'
'M' = 'Male' ;
Value $RES 'A' = 'Manhattan'
'B' = 'Bronx'
'C' = 'Brooklyn'
'D' = 'Queens'
'E' = 'Staten Island'
'F' , 'G' , 'H' , 'I' , '0' ,
'1' , '2' , 'V' , 'W' , 'X' ,
'Y' , 'Z' , '3' ,
'J' = 'Other NY State'
'K' , 'L' , 'M' , 'N' , 'O' ,
'P' , 'Q' , '6' , '7' , '8' ,
'9' ,
'R' = 'Other NJ State'
'S' , 'T' , 'U' , '4' ,
'5' = 'Other' ;
Run ;
* Ods PRINTER PDF File='ISISDEM PDF U' ;
Proc TABULATE Data=ISIS Format=5. MISSING ;
Class MAJOR ETHNIC SEX RCDE ;
Table MAJOR,(ETHNIC*SEX ALL),
RCDE*(N PctN*F=Percent7.2) ALL /
MissText=' ' Box=_PAGE_ ;
KeyLabel N = 'Total' PctN = '%' ;
Label ETHNIC = 'Ethnicity'
MAJOR = 'Academic Major --> '
RCDE = 'Residency Code'
SEX = 'Gender' ;
Format ETHNIC $Eth. SEX $Sex. RCDE $Res. ;
Title 'Population Distribution By Major' ;
Run ;
* Ods PRINTER Close ;
|