Date: Tue, 14 Jan 1997 09:48:35 +0000
Reply-To: n.w.nelson@education.leeds.ac.uk
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: nick nelson <n.w.nelson@EDUCATION.LEEDS.AC.UK>
Organization: Leeds University
Subject: Re: Aggregating
Content-Type: text/plain; charset=us-ascii
phewett@popcouncil.org wrote:
>
> Hello..
>
> I am attempting to create a variable that is a count (or mean, or max,
> etc.) of the number of observations of another variable (across
> cases), by subgroubs (splitfile). However, I want to assign this
> variable across all the cases, by subgroup. In Stata this is simply
> done using egen, but I don't know if there is an SPSS equivalent. The
> aggregate function does not seem to be too useful here. Any help ??
>
> ex:
>
> smoke pot ? sex newvar (count) newvar (mean)
> 1 1 3 .75
> 0 1 3 .75
> 1 1 3 .75
> 1 1 3 .75
> 1 0 2 .66
> 1 0 2 .66
> 0 0 2 .66
SORT CASES BY
sex (A) .
AGGREGATE
/OUTFILE='C:\XFILES\DATA\AGGR.SAV'
/BREAK=sex
/smoke_1 = MEAN(smoke)
/N_BREAK=N.
MATCH FILES /FILE=*
/TABLE='C:\XFILES\DATA\AGGR.SAV'
/BY sex.
EXECUTE.
Regards, Nick.
BTW, this is pretty straightforward using dialogues rather than
syntax.
|