Hi everyone,
I'm trying to merge two datasets and I keep on getting error #5131 (Duplicate key on a TABLE file. Each case on a TABLE file in MATCH FILES must be uniquely identified by the BY variables.) The two datasets are: dataset1 a b c 6001500 600100 23054 6002300 600200 9597 6008900 600300 10564 6003300 600400 13330 6001100 600500 13544 6003300 600500 1 6011300 600500 1 6000701 600600 2145 dataset2 b c d 600100 100 63 600100 100 63 600100 100 63 600300 300 146 600300 300 146 600300 300 146 600300 300 146 600300 300 146 The syntax i'm using is the following: MATCH FILES file='dataset2' /table='dataset1' /BY b. SAVE OUTFILE='newdataset'. Any suggestions as to what I'm doing wrong is greatly appreciated!!! -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
If dataset 2 really is a table lookup file, you could start by getting rid of the duplicate entries in that table. There appear to be only two unique cases in that file. But since there are also only two cases in dataset 1 with matching values of B, this doesn't really look like much of a table lookup situation. What do expect the merged file to look like? What does the value of variable B represent? On Sat, Nov 18, 2017 at 8:49 AM, Greg <[hidden email]> wrote: Hi everyone, |
Administrator
|
In reply to this post by Greg
The error message is pretty obvious. Look at your 'table' there are
duplicates. ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by Greg
Greg,
The culprit is "600500" in the 5-7th rows of your table= file (dataset 1). The 3 rows with 600500 have 2 values for c andand 3 values for a. This will only work if dataset1 has only 1 row for each value of the 'by" variable. Also, variable c appears to differ between datasets--you may need to include a /rename statement for one of the files if they truly are different variables. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Greg Sent: Saturday, November 18, 2017 9:49 AM To: [hidden email] Subject: [SPSSX-L] merging question Hi everyone, I'm trying to merge two datasets and I keep on getting error #5131 (Duplicate key on a TABLE file. Each case on a TABLE file in MATCH FILES must be uniquely identified by the BY variables.) The two datasets are: dataset1 abc 600150060010023054 60023006002009597 600890060030010564 600330060040013330 600110060050013544 60033006005001 60113006005001 60007016006002145 dataset2 bcd 60010010063 60010010063 60010010063 600300300146 600300300146 600300300146 600300300146 600300300146 The syntax i'm using is the following: MATCH FILES file='dataset2' /table='dataset1' /BY b. SAVE OUTFILE='newdataset'. Any suggestions as to what I'm doing wrong is greatly appreciated!!! -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 ________________________________ This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately. Please notify the sender if you have received this email in error. NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Free forum by Nabble | Edit this page |