Date: Mon, 14 Feb 2005 15:28:20 -0500
Reply-To: Art@DrKendall.org
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Art Kendall <Art@DRKENDALL.ORG>
Organization: Social Research Consultants
Subject: Re: Match Command
In-Reply-To: <4210EE1E.7050301@silcom.com>
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
detail.
Hope this helps.
Art
Art@DrKendall.org
Social Research Consultants
University Park, MD USA
(301) 864-5570
data list list / id(N4) fname(a20) mi(a1) lname(a20).
begin data
1234 'John' 'Q' 'Public'
5678 'Mary' 'L' 'Smith'
2345 'Wiley' 'E' 'Coyote'
end data.
sort cases by ID.
save outfile= 'd:\project\personal.sav'.
new file.
data list list /ID (N4) procdate(adate10).
begin data
1234 5/28/1999
5678 7/4/1999
2345 1/1/1990
2345 3/22/2003
5678 3/3/2003
5678 10/10/2004
1234 11/11/2003
end data.
sort cases by ID procdate.
Match files
file=*
/table= 'd:\project\personal.sav'
/by ID
/map.
list.
VKogler wrote:
> 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
> avail.
>
> 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?
>
>
> Thanks
>
> Victor Kogler
>
>
|