LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 23 Mar 2002 15:52:02 -0300
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Hector Maletta <>
Subject:   Re: Adding
Comments:   To: Will Franks <>
Content-Type:   text/plain; charset=us-ascii

Will: Use AGGREGATE. Go to the Data screen, and choose Data-Aggregate. This would create a new file of aggregated cases. If you want the sum of the variable Y for particular subgroups, say for each value of the variable X, then you should indicate that the aggretation is to be broken down by X. If you want just the overall sum, you should first create a variable that is constant for everybody, then use that variable to "break" the aggregation. This new aggregated file could then be merged with the original file, assigning to each original case the aggregated variable from the aggregated file. Of course, the aggregated variable need not be a sum: it could also be an average, or a fraction of cases, or the value of the first case in each group, or the value of the last case, or the maximum or minimum value encountered within each group, and so on (look for help on Aggregate).

Example with syntax: GET FILE 'original.sav'. COMPUTE X=1. save outfile 'original.sav'. AGGREGATE OUTFILE=*/break=X /YSUMMED=SUM(Y).

MATCH FILES /FILE = 'ORIGINAL.SAV'/TABLE=*/by X. save outfile 'augmented original.sav'.

In the menu: 1. Go to Data - Transform - Compute to create the X variable if needed. Save the file. 2. Go to Data - Aggregate. Follow instructions. Create only one aggregated variable (the sum you need) or more variables as needed. The aggregated file will become the active file. 3. Go to Data - Merge files - Add new variables. External file: 'original.sav'. Choose that the working file is a keyed table. Choose X as the key variable for the matching. Proceed. Save the resulting file with the name 'augmented original.sav' or whatever you like. Notice that the file resulting from AGGREGATE is a file with one record per group (only one record if you want the sum total of all cases). For the matching, this smaller file is designated as a "TABLE", i.e. a lookup table whose variables would be assigned to any case in the other file that matches the value of the key variable (X). In the case of an overall sum, the overall sum is added to all cases in the original file; if the sum was obtained separately for different groups (say, for various neighbourhoods, or for each sex, or whatever), all cases in each neighbourhood or sex would be assigned the sum of Y obtained in that neighbourhood or sex.

Hector Maletta Universidad del Salvador Buenos Aires, Argentina

Will Franks wrote: > > Hi My name is Will and I new to the group. > > I was wondering if there is anyway to add across cases and make that sum a > new variable. For example: > > number of people Total number of people > 1 6 > 2 6 > 3 6 > > Thanks in advance > > Will > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: >

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