| Date: | Mon, 21 Sep 2009 18:23:34 -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: keyed table merge not working |
|
| In-Reply-To: | <EFCF16377594714C9B2B3A8CFC31615D0139031D@svrmail.RMC.local > |
| Content-Type: | text/html; charset="us-ascii" |
|---|
<html>
<body>
At 07:41 PM 9/17/2009, Dennis Deck wrote:<br><br>
<blockquote type=cite class=cite cite="">A simpler approach would be to
first create a master file of all the IDs and then merge the ID, pre, and
post files : </blockquote><br>
It's a good idea; but it won't work in cases like this one, where one or
both of the two files can have multiple records for the same ID:<br><br>
<tt><font size=2>MATCH FILES<br>
File= IDfile<br>
/Table= table_1 /In=In_1<br>
/Table= table_2 /In=In_2<br>
/BY ID .<br>
DATASET NAME Combined .<br>
File #3<br>
KEY:
1<br><br>
>Error # 5131<br>
>Duplicate key on a TABLE file. Each case on a TABLE file
in<br>
>MATCH FILES must be uniquely identified by the BY variables.<br>
>This command not executed.<br><br>
</font></tt>=====================<br>
APPENDIX: Code tested<br>
=====================<br>
This uses datasets 'table_1' and 'table_2' that were the test data in my
previous posting.<br><br>
<tt><font size=2>ADD FILES<br>
/File=table_1 <br>
/File=table_2 <br>
/Keep= ID .<br>
<br>
AGGREGATE Outfile=* <br>
/Break= ID <br>
/NOccur=NU.<br><br>
DATASET NAME IDfile .<br><br>
MATCH FILES <br>
File= IDfile<br>
/Table= table_1 /In=In_1<br>
/Table= table_2 /In=In_2<br>
/BY ID . <br>
DATASET NAME Combined .</font></tt> </body>
<br>
</html>
=====================
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
|