=========================================================================
Date: Mon, 24 Jul 2006 16:00:48 0500
ReplyTo: "Beadle, ViAnn" <viann@spss.com>
Sender: "SPSSX(r) Discussion" <SPSSXL@LISTSERV.UGA.EDU>
From: "Beadle, ViAnn" <viann@spss.com>
Subject: Re: aggregate or matrix?
ContentType: text/plain; charset="iso88591"
Have you looked at the reporting tools rather than doing this through AGGREGATE. By this I mean things like TABLES, or CTABLES.
Original Message
From: SPSSX(r) Discussion [mailto:SPSSXL@LISTSERV.UGA.EDU] On Behalf Of Frank Berry
Sent: Monday, July 24, 2006 2:30 PM
To: SPSSXL@LISTSERV.UGA.EDU
Subject: aggregate or matrix?
Hi all,
I have four variables (subj, region, eth  all char variables, and score  numeric variable) with a total of 20,000 records.
Below is a syntax used to get count (N), average, standard deviation (SD) and pct for each category (e1 to e5) in the variable of 'eth' BY 'subj' 'region' 'eth'.
AGGREGATE
/OUTFILE = 'C:\Data\Sum_A.sav'
/BREAK = subj region eth
/count = N
/avg = MEAN(score)
/sd = SD(score)
/eth1_frac = FIN(eth,1,1)
/eth2_frac = FIN(eth,2,2)
/eth3_frac = FIN(eth,3,3)
/eth4_frac = FIN(eth,4,4)
/eth5_frac = FIN(ethnic,5,5).
COMPUTE eth1_N = eth1_frac*count.
COMPUTE eth2_N = eth2_frac*count.
COMPUTE eth3_N = eth3_frac*count.
COMPUTE eth4_N = eth4_frac*count.
COMPUTE eth5_N = eth5_frac*count.
COMPUTE e1_Pct = eth1_N/count*100.
COMPUTE e2_Pct = eth2_N/count*100.
COMPUTE e3_Pct = eth3_N/count*100.
COMPUTE e4_Pct = eth4_N/count*100.
COMPUTE e5_Pct = eth5_N/count*100.
Execute.
Below is what I'd like to get in addition to the count, mean and SD BY 'subj' 'region' 'eth'.
region eth N pct prop
0001 e1 1 2% 0.015384615
0001 e2 5 8% 0.076923077
0001 e3 22 34% 0.338461538
0001 e4 30 46% 0.461538462
0001 e5 7 11% 0.107692308
0001 Total 65 100% 1
But the aggregate function above doesn't seem to work here. Is there a solution using matrix or other functions/syntax? Thank you.
Frank

