Date: Thu, 2 Sep 2010 10:26:03 -0700
Reply-To: J McClure <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: J McClure <email@example.com>
Subject: Solved 'collapse' data
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Thanks! Your code worked.
On 9/2/2010 10:13 AM, Marks, Jim wrote:
> Can you post your aggregate syntax?
> Something like this should have worked:
> DATASET DECLARE sumfile.
> AGGREGATE OUTFILE = sumfile /BREAK = diaggrp /cases = SUM (total).
> DATASET ACTIVATE sumfile'
> Jim Marks
> Director, Market Research
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
> J McClure
> Sent: Thursday, September 02, 2010 12:07 PM
> To: SPSSX-L@LISTSERV.UGA.EDU
> Subject: 'collapse' data
> I have data from a one month period of time in an emergency room. The
> data is by diagnosis not by individuals (var is Dx). For each of
> diagnosis of 58 diagnoses I have the number of times it was listed as
> the diagnosis (var 'total') for 224 individuals admitted to the
> emergency department for that month. Because the 'total' reflects
> listing of a diagnosis as a primary or secondary one, the 'total' sums
> to more than 224. I created a new variable (DxGrp) and assigned each of
> the 58 diagnoses to one of the 7 diagnostic groups. I want to 'collapse'
> the information such that I have 7 diagnostic groups and the number of
> times that group was the primary or secondary diagnoses.
> I tried aggregate but got the number of times each DxGrp was found in
> the list of 58 diagnose. I considered count but I don't think I need to
> sum values across variables. I also considered compute but can't figure
> out how to write the syntax.
> Any help appreciated. Jan
> Here is a sample of the data.
> Dx POSTTRAUMATIC STRESS DIS total 55 DxGrp 5
> Dx DEPRESSIVE DISORDER NEC total 39 DxGrp 1
> Dx ALCOH DEP NEC/NOS-UNSPEC total 16 DxGrp 7
> Dx RECURR DEPR DISORDER-MOD total 14 DxGrp 1
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command