Date: Thu, 5 Dec 1996 08:30:38 -0800
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: "Hector E. Maletta" <hmaletta@OVERNET.COM.AR>
Subject: Re: Calculating (& saving) a mean value across cases
Jeremy Miles wrote:
> At 14:41 04/12/96 -0500, Andrew Gotowiec wrote:
> >In SPSSWIN v6.1.2, is there any way to calculate a mean value for a
> >variable across cases and then save that value for use in subsequent
> >Any help would be gratefully received.
> COMPUTE meanvar = MEAN(var1, var2, var3) .
> Or available in transform, compute.
> Hope that helps.
> Jeremy Miles, Psychology Division, Derby University, DE3 5GX
> Work: 01332 622222 x. 2173 email@example.com
> =====================No Space for a Joke=====================
Jeremy, I'm afraid you missed the point of the question. Your answer
gives a mean across variables (for every case), whilst the question was
a mean across cases (for a given variable).
The only way I find to do the trick is through AGGREGATE. First, you
agggregate the cases into one or various groups, and define a new
variable at the aggregate level which is the average of some original
variable. This gets saved in a new (aggregated file) with only one or
more "super-cases" which represent aggregations of the original cases.
Second, you assign that mean to every individual case through MERGE
FILES /ADD VARIABLES considering the aggregate file as a TABLE. The
syntax for a simple case would be:
SORT CASES BY ID.
MATCH FILES /FILE=DATA.SAV / TABLE=MEANS.SAV/BY X.
This example computes only an overall mean for the variable Y, because
the aggregating variable X is a constant (X=1) for all cases. If the
means of subgroups are desired, the only modification would be using
some grouping variable Z instead of X.
Hope this helps.
Dept of Social Science
Universidad del Salvador
Buenos Aires, Argentina