Date: Mon, 5 Dec 2005 14:45:57 +0100
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Antoon Smulders <email@example.com>
Subject: Two aggregate questions
Content-Type: text/plain; charset="us-ascii"
Hello list members,
Often I have the following (related) problems:
I have a file with multiple records for each subject, for instance
(literally) criminal records, with fields (variables) like:
Id, date, place, crime.
Now often I want to aggregate this file in such a way that all VALUES of a
certain variable are represented as new VARIABLES in the aggregated file.
AGGREGATE OUTFILE * /BREAK Id
/murder = PIN (crime, 1,1)
/robbery = PIN (crime, 2, 2)
My first question is if it is possible to automate this. (Maybe creating
automatic variable names like agg001 agg002 etc.)
Next I often want to have the frequencies of the values in the aggregated
file. In the above example: Id John commits variable murder 1 time, robbery
4 times etc.
What I do until now is add an aggregate variable:
/number = N
and then calculate the original frequencies with the "pin variable".
I also considered aggregating the file in two steps:
Is there a more elegant way?
Thanks in advance.