Date: Thu, 18 Sep 2008 23:41:32 -0400
Reply-To: Richard Ristow <wrristow@mindspring.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <wrristow@mindspring.com>
Subject: Re: Many-to-One Issue
In-Reply-To: <19542188.post@talk.nabble.com>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 06:44 PM 9/17/2008, cfishernyc wrote:
>I have two files with one common key. In one file the common key
>(RIN) has duplicates (within a client) as the clients have a row for
>each admission. In the other, the RIN only occurs once, as they have one DOB.
>For some reason, no matter if I make the current table keyed or
>non-keyed, it freaks out.
What happens when you tried it? Anyhow, Melissa's suggestion should
be fine. Here's a demo, with your test data and the logic Melissa
suggested. Notice that RIN is used for matching, without Name.
DATASET ACTIVATE File1 WINDOW=FRONT.
LIST.
List
|-----------------------------|---------------------------|
|Output Created |18-SEP-2008 23:35:34 |
|-----------------------------|---------------------------|
[File1]
RIN Name DOB
1234 bobsmith 03/03/2003
1235 sarahtall 04/05/2002
Number of cases read: 2 Number of cases listed: 2
DATASET ACTIVATE File2 WINDOW=FRONT.
LIST.
List
|-----------------------------|---------------------------|
|Output Created |18-SEP-2008 23:35:34 |
|-----------------------------|---------------------------|
[File2]
RIN Name_2 AdmissionDate
1234 bobsmith 03/03/2010
1234 bobsmith 04/04/2005
1234 bobsmith 05/05/2006
1235 sarahtall 07/07/2008
Number of cases read: 4 Number of cases listed: 4
MATCH FILES
/TABLE=File1
/FILE =File2
/BY RIN.
LIST.
List
|-----------------------------|---------------------------|
|Output Created |18-SEP-2008 23:35:34 |
|-----------------------------|---------------------------|
RIN Name DOB Name_2 AdmissionDate
1234 bobsmith 03/03/2003 bobsmith 03/03/2010
1234 bobsmith 03/03/2003 bobsmith 04/04/2005
1234 bobsmith 03/03/2003 bobsmith 05/05/2006
1235 sarahtall 04/05/2002 sarahtall 07/07/2008
Number of cases read: 4 Number of cases listed: 4
=============================
APPENDIX: Test data, and code
=============================
* File1.
DATA LIST LIST /
RIN Name DOB
(F4, A10, ADATE10).
BEGIN DATA
1234 bobsmith 3/3/03
1235 sarahtall 4/5/02
END DATA.
DATASET NAME File1 WINDOOW=FRONT.
* File2.
DATA LIST LIST /
RIN Name_2 AdmissionDate
(F4, A10, ADATE10).
BEGIN DATA
1234 bobsmith 3/3/10
1234 bobsmith 4/4/05
1234 bobsmith 5/5/06
1235 sarahtall 7/7/08
END DATA.
DATASET NAME File2 WINDOW=FRONT.
DATASET ACTIVATE File1 WINDOW=FRONT.
LIST.
DATASET ACTIVATE File2 WINDOW=FRONT.
LIST.
MATCH FILES
/TABLE=File1
/FILE =File2
/BY RIN.
LIST.
=====================
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