Date: Wed, 22 Sep 1999 21:06:16 -0400
Reply-To: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject: Re: aggregation funtion
Content-type: text/plain; charset=iso-8859-1
Hi giuseppe and listers!
Suppose your variable is called "amount" and that you need the mean, min and
max value of amount in your syntax.
Unfortunately, you cannot use something like
Compute diff = v1 - Mean (amount).
Instead you may use something like the following (there are other ways but
this is often the simplest method, give us more details if this is not a
satisfactory solution in your case):
(Replace the file name in the aggregate and match commands by your path and
file name)
COMPUTE dummy=1.
AGGREGATE
/OUTFILE='C:\Program Files\SPSS\test\AGGR_t.SAV'
/BREAK=dummy
/mean_v = MEAN(amount) /min_v = MIN(amount) /max_v = MAX(amount).
MATCH FILES /FILE=*
/TABLE='C:\Program Files\SPSS\test\AGGR_t.SAV'
/BY dummy.
EXECUTE.
You can now use:
Compute diff = v1 - mean_v.
Compute diff = v1 - min_v.
Compute diff = v1 - max_v.
HTH
Raynald Levesque rlevesque@videotron.ca
----- Original Message -----
From: giuseppe vergani <jupiter@GALACTICA.IT>
Newsgroups: bit.listserv.spssx-l
To: <SPSSX-L@LISTSERV.UGA.EDU>
Sent: Wednesday, September 22, 1999 8:53 PM
Subject: aggregation funtion
> Is there no way to use aggregation function in syntax? I've to write
> formulas containing min, max and mean values of variables, but it seems
> impossible.
> I've have to write something like this:
> Compute diff = v1 - Mean (v2)
> where MIN (v2) is the mean value of the variable V2.
>
> Thanks a lot
>
> Giuseppe Vergani