LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 2 Oct 2006 15:10:42 -0400
Reply-To:     Mahbub Khandoker <Mahbub_Khandoker@camh.net>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Mahbub Khandoker <Mahbub_Khandoker@camh.net>
Subject:      Re: How to calculate the average for many observations?
Comments: To: Dimitris Nikolaou <dimnik2004@hotmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Custom table can provide the averages.

A new database is created,

DATA LIST free/ age(n2) sex(a6) edu0 (n1) edu1(n1) edu2 (n2) edu3 (n2) inwage (f10.2). Begin data 20 male 1 0 0 0 0 20 male 1 0 0 0 9.65 20 male 1 0 0 0 8.56 20 male 0 1 0 0 7.65 20 male 0 1 0 0 0 20 male 0 0 1 0 8.23 20 female 1 0 0 0 9.65 20 female 1 1 0 0 7.65 21 male 1 0 0 0 0 21 male 1 0 0 0 9.65 21 male 1 0 0 0 8.56 21 male 0 1 0 0 7.65 22 male 0 1 0 0 0 22 male 0 0 1 0 8.23 22 female 1 0 0 0 9.65 22 female 1 1 0 0 7.65 End data. Execute.

* Custom Tables. CTABLES /VLABELS VARIABLES=inwage age sex edu0 edu1 edu2 edu3 DISPLAY=DEFAULT /TABLE age [C] > sex > edu0 [C] > edu1 [C] > edu2 [C] > edu3 [C] BY inwage [MEAN] /CATEGORIES VARIABLES=age sex edu0 edu1 edu2 edu3 ORDER=A KEY=VALUE EMPTY=EXCLUDE.

* ANOTHER way getting the averagesCustom Tables. CTABLES /VLABELS VARIABLES=sex inwage age edu0 edu1 edu2 edu3 DISPLAY=DEFAULT /TABLE age [C] > edu0 [C] > edu1 [C] > edu2 [C] > edu3 [C] BY sex > inwage [MEAN] /CATEGORIES VARIABLES=sex age edu0 edu1 edu2 edu3 ORDER=A KEY=VALUE EMPTY=EXCLUDE.

Thanks, Mahbub

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Dimitris Nikolaou Sent: 2-Oct-06 2:21 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: How to calculate the average for many observations?

Hi to everybody!

I have recently come up with a problem. This is a general example:

age sex educ0 educ1 educ2 educ3 lnwage 20 male 1 0 0 0 0 20 male 1 0 0 0 9.65 20 male 1 0 0 0 8.56 20 male 0 1 0 0 7.65 20 male 0 1 0 0 0 20 male 0 0 1 0 8.23 20 male 0 0 1 0 8.15 20 male 0 0 1 0 8.00 20 male 0 0 1 0 0 20 male 0 0 0 1 8.88 20 male 0 0 0 1 0 20 male 0 0 0 1 6.57 20 female 1 0 0 0 0 20 female 1 0 0 0 9.65 20 female 1 0 0 0 8.56 20 female 0 1 0 0 7.65 20 female 0 1 0 0 0 20 female 0 0 1 0 8.23 20 female 0 0 1 0 8.15 20 female 0 0 1 0 8.00 20 female 0 0 1 0 0 20 female 0 0 0 1 8.88 20 female 0 0 0 1 0 20 female 0 0 0 1 6.57

I would like to find a way so as the spss to calculate the average for eevery team. By this I mean I want to calculate the following:

if (age=20 and sex=male and educ0=1) then calculate (9.65+8.56)/2. The average only for those who have wages. if (age=20 and sex=male and educ1=1) then calculate (7.65)/1. .... .... .... if (age=20 and sex=female and educ3=1) then calculate (8.88+6.57)/2.

And I want to do this for every age from 17 to 65. I tried to calculate it but with no success. My only alternative is to make the calculations manually. But I have to do this for about 800.000 observation and for more than once.So I was wondering if there is a faster way.

Thanks in advance!

_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


Back to: Top of message | Previous page | Main SPSSX-L page