=========================================================================
Date: Mon, 17 Jul 2006 16:54:06 -0400
Reply-To: Gene Maguin <emaguin@buffalo.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Gene Maguin <emaguin@buffalo.edu>
Subject: Re: mean
In-Reply-To: <1d3820970607171035u43a42e38r1197411cbdb5de61@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
Ranjan,
There are several ways, I believe, to go at this. Let va1 and vb1 be two
variables from your list of 158. There are two cases to consider. 1) a case
that is missing for va1 is also missing for vb1 and vice versa. 2) case 1 is
not true.
If case 1 is true, then you can use Aggregate (which you should read about
in the documentation).
Compute tag=1. /* this is the trick.
Aggregate /outfile=*/break=tag/va1 vb1=mean(va1 vb1).
Do repeat x=va1/y=vb1/z=diff1.
+ compute z=x-y.
End repeat.
If case 2 is true (i.e., case 1 is not true), then, depending on the
following choice, you may have a more difficult job. If va1 is missing for
some cases but vb1 is not, you can either make the missing value status of
va1 and vb1 consistent on a case-by-case basis or ignore that inconsistency.
Making the missing value status consistent means modifying the dataset so
that case 1 is true.
To do that (enforce consistency), insert this code before the 'trick'
statement above.
Do repeat x=va1/y=vb1.
+ if (sysmis(va1)) vb1=$sysmis.
+ if (sysmis(vb1)) va1=$sysmis.
End repeat.
If case 1 is true or missing value status consistency doesn't matter, then
another way might be to use the OMS commands to export the output of a
descriptives command and then operate on that new dataset. However, I have
not done this. Someone else can comment.