LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 23 Oct 2003 09:21:35 -0700
Reply-To:   "Raffe, Sydelle, SSA" <DRaffe@co.alameda.ca.us>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   "Raffe, Sydelle, SSA" <DRaffe@co.alameda.ca.us>
Subject:   Re: data structure.xls
Comments:   To: Richard Ristow <wrristow@mindspring.com>
Content-Type:   text/plain; charset="iso-8859-1"

I didn't capture one aspect clearly. In the groups of records identified by casenum, only one record in some of the groups has a 1 in it. I need to capture all the records associated with that record according to casenum. Thanks.

-----Original Message----- From: Richard Ristow [mailto:wrristow@mindspring.com] Sent: Wednesday, October 22, 2003 7:13 PM To: Raffe, Sydelle, SSA; SPSSX-L@LISTSERV.UGA.EDU Subject: Re: data structure.xls

At 01:20 PM 10/22/2003 -0700, Raffe, Sydelle, SSA wrote:

>I have a file wherein records are keyed together by >"casenum". Casenum groups can be from 2 to 16(highly unlikely) >records. I need to identify groups of records with the same casenum >where there is a code 1 in the last column. > >I'd like to end up with an excel data base with only those groups of >records keyed by casenum where there is a one in that column (variable).

Well, in SPSS this is easy with AGGREGATE/MATCH FILES. I'll let you move it to Excel yourself.

If I have this right, you want all records where *any* record with the same "casenum" has a 1 in a variable I'll call LASTCOL.

This is untested code. I assume you can write scratch files freely to c:\TEMP.

*----------------------------------------------. SORT CASES BY CASENUM. /* Put groups together */

TEMPORARY. COMPUTE LAST_IS1 = 0. IF (LASTCOL = 1) LAST_IS1 = 1. AGGREGATE/OUTFILE='c:\TEMP\KEEP_GRP.SAV' /BREAK= CASENUM /KEEP_GRP = MAX(LAST_IS1).

MATCH FILES/FILE=*/FILE='c:\TEMP\KEEP_GRP.SAV' /BY CASENUM. SELECT IF (KEEP_GRP = 1). *----------------------------------------------. There are variations, of course, but this should work quickly and easily.


Back to: Top of message | Previous page | Main SPSSX-L page