Date: Mon, 14 Feb 2005 15:28:20 -0500
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Art Kendall <Art@DRKENDALL.ORG>
Organization: Social Research Consultants
Subject: Re: Match Command
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Save all your current work, then open a new instance of SPSS.
Cut-and-paste the syntax at the end of this message.
change the filespec 'd:\project\personal.sav' to suit your situation.
Then run it.
Does this do what you want? If not please restate your question in more
Hope this helps.
Social Research Consultants
University Park, MD USA
data list list / id(N4) fname(a20) mi(a1) lname(a20).
1234 'John' 'Q' 'Public'
5678 'Mary' 'L' 'Smith'
2345 'Wiley' 'E' 'Coyote'
sort cases by ID.
save outfile= 'd:\project\personal.sav'.
data list list /ID (N4) procdate(adate10).
sort cases by ID procdate.
> Hello all,
> There was recent discussion on the list regarding the use of the Match
> command as an alternative to a lengthy Recode operation to create a
> 'State' variable on the basis of zip code values. I thought this was
> just the approach to deal with a problem I was working on, but to no
> From a file of about 90,000 admission records, I have identified 2,700
> patients that have received a particular type of care in a particular
> group of clinics. In our system, these 2,700 people have had multiple
> treatment episodes. These could have occurred at any of 35 different
> clinics over the past 5 years. What I wanted to do, on the basis of a
> unique patient ID, was to create an SPSS file containing a record for
> each treatment episode these patients have had in the overall system.
> In database terms [where I eventually solved the problem in SQL 2k] I
> wanted to create a table based on the one-to-many relationship between
> the patient ID table and the complete patient admission record table.
> The end result would be a table containing a record for each treatment
> admission for these 2,700 persons - 2,700 unique patient ID's with
> multiple admission records, for a total of 5,500 cases.
> I fooled around with the Match and Add commands in every possible
> permutation without success. The documentation and GUI indicated that a
> one-to-many match on the basis of paired and sorted key variables was
> doable, but this function was available only to add variables, not to
> add cases. It wasn't really that big a deal to swap the data back and
> forth between applications, but I would have preferred to have dealt
> with the matter entirely from within SPSS.
> Any thoughts on what I might have been doing incorrectly?
> Victor Kogler