|
Hi,
I have the following file (main.sav) where values for variables varx, vary and varz are all blank. id var1 var2 var3 varx vary varz 33001723 70619 617 1077844559 33003761 70530 617 1077844559 33005253 70127 617 1077844559 33005253 70531 617 1077844559 33007736 70127 617 1077844559 33018241 70620 617 1077844559 33018647 70127 617 1077844559 33018647 70526 617 1077844559 33020718 70531 617 1077844559 I would like to merge this file (table.sav) with the following file and fill in the values from varx, vary and varz from this file (table.sav) into the file above (main.sav). id varx vary varz 33001723 4 1 55 33003761 5 0 66 33005253 3 1 8 33007736 7 0 8 33018241 4 1 90 33018647 6 1 21 33020718 3 1 12 I have tried using the following syntax but variables varx, vary, varz are not replaced in the main.sav from the table.sav file. GET FILE = 'C:\Documents and Settings\test\linglng\data.sav'. SORT CASE BY id (A). GET FILE = 'C:\Documents and Settings\test\linglng\table2.sav'. SORT CASE BY id (A). MATCH FILES /FILE='C:\Documents and Settings\test\linglng\data.sav' /TABLE='C:\Documents and Settings\test\linglng\table2.sav' /BY id. EXECUTE. SAVE OUTFILE = sort3.sav. Any suggestions would be greatly appreciated. Thanks, Lucia ===================== 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 |
|
Hi Lucia,
Since varx, vary and varz all are blank in main.sav file you could delete or rename varx, vary and varz in that file. Then your merge procedure will work according to your syntax. Thanks, Mahbub Khandoker Decision Support Tel: 416 535 8501 Ex 6534 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lucia Costanzo Sent: Monday, June 02, 2008 10:53 AM To: [hidden email] Subject: merging files Hi, I have the following file (main.sav) where values for variables varx, vary and varz are all blank. id var1 var2 var3 varx vary varz 33001723 70619 617 1077844559 33003761 70530 617 1077844559 33005253 70127 617 1077844559 33005253 70531 617 1077844559 33007736 70127 617 1077844559 33018241 70620 617 1077844559 33018647 70127 617 1077844559 33018647 70526 617 1077844559 33020718 70531 617 1077844559 I would like to merge this file (table.sav) with the following file and fill in the values from varx, vary and varz from this file (table.sav) into the file above (main.sav). id varx vary varz 33001723 4 1 55 33003761 5 0 66 33005253 3 1 8 33007736 7 0 8 33018241 4 1 90 33018647 6 1 21 33020718 3 1 12 I have tried using the following syntax but variables varx, vary, varz are not replaced in the main.sav from the table.sav file. GET FILE = 'C:\Documents and Settings\test\linglng\data.sav'. SORT CASE BY id (A). GET FILE = 'C:\Documents and Settings\test\linglng\table2.sav'. SORT CASE BY id (A). MATCH FILES /FILE='C:\Documents and Settings\test\linglng\data.sav' /TABLE='C:\Documents and Settings\test\linglng\table2.sav' /BY id. EXECUTE. SAVE OUTFILE = sort3.sav. Any suggestions would be greatly appreciated. Thanks, Lucia ===================== 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 email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ===================== 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 |
|
Per the SPSS help under Match files-->Operations
"Variables are copied in order from the first file specified, then from the second file specified, and so on. If the same variable name is used in more than one input file, data are taken from the file specified first. Dictionary information is taken from the first file containing value labels, missing values, or a variable label for the common variable. If the first file has no such information, MATCH FILES checks the second file, and so on, seeking dictionary information ". In your syntax the /FILE dataset is listed first, so those values are kept in your final file. If you switch the order of the files in your syntax command, it will keep the values in the /table file. MATCH FILES /TABLE='C:\Documents and Settings\test\linglng\table2.sav' /FILE='C:\Documents and Settings\test\linglng\data.sav' /BY id. Be aware that the variables will be in the /table2.sav file order, so you may need to include a /keep statement to put the data into a different order. Alternatively--look into the UPDATE command. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mahbub Khandoker Sent: Monday, June 02, 2008 10:21 AM To: [hidden email] Subject: Re: [SPSSX-L] merging files Hi Lucia, Since varx, vary and varz all are blank in main.sav file you could delete or rename varx, vary and varz in that file. Then your merge procedure will work according to your syntax. Thanks, Mahbub Khandoker Decision Support Tel: 416 535 8501 Ex 6534 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lucia Costanzo Sent: Monday, June 02, 2008 10:53 AM To: [hidden email] Subject: merging files Hi, I have the following file (main.sav) where values for variables varx, vary and varz are all blank. id var1 var2 var3 varx vary varz 33001723 70619 617 1077844559 33003761 70530 617 1077844559 33005253 70127 617 1077844559 33005253 70531 617 1077844559 33007736 70127 617 1077844559 33018241 70620 617 1077844559 33018647 70127 617 1077844559 33018647 70526 617 1077844559 33020718 70531 617 1077844559 I would like to merge this file (table.sav) with the following file and fill in the values from varx, vary and varz from this file (table.sav) into the file above (main.sav). id varx vary varz 33001723 4 1 55 33003761 5 0 66 33005253 3 1 8 33007736 7 0 8 33018241 4 1 90 33018647 6 1 21 33020718 3 1 12 I have tried using the following syntax but variables varx, vary, varz are not replaced in the main.sav from the table.sav file. GET FILE = 'C:\Documents and Settings\test\linglng\data.sav'. SORT CASE BY id (A). GET FILE = 'C:\Documents and Settings\test\linglng\table2.sav'. SORT CASE BY id (A). MATCH FILES /FILE='C:\Documents and Settings\test\linglng\data.sav' /TABLE='C:\Documents and Settings\test\linglng\table2.sav' /BY id. EXECUTE. SAVE OUTFILE = sort3.sav. Any suggestions would be greatly appreciated. Thanks, Lucia ===================== 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 email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ===================== 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 PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. ===================== 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 seems to me to be a classic example for the UPDATE command.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Melissa Ives Sent: Monday, June 02, 2008 9:27 AM To: [hidden email] Subject: Re: merging files Per the SPSS help under Match files-->Operations "Variables are copied in order from the first file specified, then from the second file specified, and so on. If the same variable name is used in more than one input file, data are taken from the file specified first. Dictionary information is taken from the first file containing value labels, missing values, or a variable label for the common variable. If the first file has no such information, MATCH FILES checks the second file, and so on, seeking dictionary information ". In your syntax the /FILE dataset is listed first, so those values are kept in your final file. If you switch the order of the files in your syntax command, it will keep the values in the /table file. MATCH FILES /TABLE='C:\Documents and Settings\test\linglng\table2.sav' /FILE='C:\Documents and Settings\test\linglng\data.sav' /BY id. Be aware that the variables will be in the /table2.sav file order, so you may need to include a /keep statement to put the data into a different order. Alternatively--look into the UPDATE command. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mahbub Khandoker Sent: Monday, June 02, 2008 10:21 AM To: [hidden email] Subject: Re: [SPSSX-L] merging files Hi Lucia, Since varx, vary and varz all are blank in main.sav file you could delete or rename varx, vary and varz in that file. Then your merge procedure will work according to your syntax. Thanks, Mahbub Khandoker Decision Support Tel: 416 535 8501 Ex 6534 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lucia Costanzo Sent: Monday, June 02, 2008 10:53 AM To: [hidden email] Subject: merging files Hi, I have the following file (main.sav) where values for variables varx, vary and varz are all blank. id var1 var2 var3 varx vary varz 33001723 70619 617 1077844559 33003761 70530 617 1077844559 33005253 70127 617 1077844559 33005253 70531 617 1077844559 33007736 70127 617 1077844559 33018241 70620 617 1077844559 33018647 70127 617 1077844559 33018647 70526 617 1077844559 33020718 70531 617 1077844559 I would like to merge this file (table.sav) with the following file and fill in the values from varx, vary and varz from this file (table.sav) into the file above (main.sav). id varx vary varz 33001723 4 1 55 33003761 5 0 66 33005253 3 1 8 33007736 7 0 8 33018241 4 1 90 33018647 6 1 21 33020718 3 1 12 I have tried using the following syntax but variables varx, vary, varz are not replaced in the main.sav from the table.sav file. GET FILE = 'C:\Documents and Settings\test\linglng\data.sav'. SORT CASE BY id (A). GET FILE = 'C:\Documents and Settings\test\linglng\table2.sav'. SORT CASE BY id (A). MATCH FILES /FILE='C:\Documents and Settings\test\linglng\data.sav' /TABLE='C:\Documents and Settings\test\linglng\table2.sav' /BY id. EXECUTE. SAVE OUTFILE = sort3.sav. Any suggestions would be greatly appreciated. Thanks, Lucia ===================== 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 email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the CAMH Email Security System. ______________________________________________________________________ ===================== 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 PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. ===================== 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 ===================== 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 |
