Date: Tue, 15 Oct 2002 07:29:27 -0400
Reply-To: Raynald Levesque <rlevesque@videotron.ca>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Raynald Levesque <rlevesque@videotron.ca>
Subject: Re: Selecting matching cases from two variables
In-Reply-To: <200210150307.g9F37AU24199@listserv.cc.uga.edu>
Content-type: text/plain; charset=iso-8859-1
Hi
This is one way:
DATA LIST LIST /id data1 TO data4.
BEGIN DATA
1 1 1 1 1
1 2 1 1 2
2 1 1 1 3
2 2 2 2 4
3 1 1 1 1
END DATA.
LIST.
SORT CASES BY id.
SAVE OUTFILE='c:\temp\database.sav'.
DATA LIST LIST /id.
BEGIN DATA
1
3
END DATA.
LIST.
SORT CASES BY id.
SAVE OUTFILE='c:\temp\id to keep.sav'.
***** Start job.
GET FILE='c:\temp\database.sav'.
MATCH FILES /FILE=*
/TABLE='C:\Temp\id to keep.sav'
/IN=keepcase
/BY id.
* Next lines deletes unwanted cases.
SELECT IF keepcase=1.
* Delete the variable keepcase.
MATCH FILES FILE=* /DROP=keepcase.
HTH
Raynald Levesque rlevesque@videotron.ca
Visit my SPSS Pages http://pages.infinit.net/rlevesqu/index.htm
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
David Preen
Sent: October 14, 2002 11:07 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Selecting matching cases from two variables
Hi,
I have a list of identification numbers and associated variables for
approximately 3000 subjects. Some subjects have more than one line (i.e.
same ID number appears but different associated variable data). I also have
a list of approximately 600 subject ID numbers that also appear throughout
the larger set (although not in any set order). The two subject ID lists
are not matched up in rows. What I want to do is select only those subjects
in the larger data set that also appear in the smaller data set. I assume
that I will have to use ‘Select’ and choose the “If’ function, however I am
unsure what to do after that. It would be greatly appreciated if you could
provide me with the procedures required.
Kind regards,
David