Date: Mon, 5 Dec 2005 14:45:57 +0100
Reply-To: a.smulders@beke.nl
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Antoon Smulders <a.smulders@beke.nl>
Subject: Two aggregate questions
In-Reply-To: <FABE7BF4C8A9B647A083DCEB99A792CF14A785@beke01.beke.local>
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.
For instance:
AGGREGATE OUTFILE * /BREAK Id
/murder = PIN (crime, 1,1)
/robbery = PIN (crime, 2, 2)
... etc
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.
Antoon Smulders
|