|
I want to compare two data files FileA and FileB by ID
and keep cases where ID in the two files are Identical . Any ideas will be welcomed . Ucal --------------------------------- Looking for last minute shopping deals? Find them fast with Yahoo! Search. ===================== 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 is not elegant or parsimonious but in case you don't receive any better advice.
1. create var x1 equal 0 for each id in file1. 2. create var x2 equal 1 for each id in file2. Open file1 and merge in variable x2 from file2 by id. Run a command: SELECT IF (x1=0 and x2=1). Exe. This will retain only the ids that are in both files. Is this what you want? Bozena Zdaniuk, Ph.D. University of Pittsburgh UCSUR, 6th Fl. 121 University Place Pittsburgh, PA 15260 Ph.: 412-624-5736 Fax: 412-624-4810 Email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ucal Gyam Sent: Tuesday, March 11, 2008 1:45 PM To: [hidden email] Subject: Comparing DATA 2 files I want to compare two data files FileA and FileB by ID and keep cases where ID in the two files are Identical . Any ideas will be welcomed . Ucal --------------------------------- Looking for last minute shopping deals? Find them fast with Yahoo! Search. ===================== 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 |
|
In reply to this post by Ucal Gyam
Ucal,
The simplest way is to match the files and use the /in subcommand to create new variables that identify if the source file contributed to the matched file Match files file=A/in=inA/ files file=B/in=inB/ by ID. *** to check how many matched/didn't match. Cro tab inA by inB. sel if ina=1 and inB=1. Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ucal Gyam Sent: Tuesday, March 11, 2008 12:45 PM To: [hidden email] Subject: [SPSSX-L] Comparing DATA 2 files I want to compare two data files FileA and FileB by ID and keep cases where ID in the two files are Identical . Any ideas will be welcomed . Ucal --------------------------------- Looking for last minute shopping deals? Find them fast with Yahoo! Search. ===================== 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 |
|
In reply to this post by Zdaniuk, Bozena-2
I wasn't sure if the answer was any more complicated than MATCH FILES
syntax, but I wasn't sure what Ucal meant by "compare two data files." Mark -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Zdaniuk, Bozena Sent: Tuesday, March 11, 2008 2:30 PM To: [hidden email] Subject: Re: Comparing DATA 2 files This is not elegant or parsimonious but in case you don't receive any better advice. 1. create var x1 equal 0 for each id in file1. 2. create var x2 equal 1 for each id in file2. Open file1 and merge in variable x2 from file2 by id. Run a command: SELECT IF (x1=0 and x2=1). Exe. This will retain only the ids that are in both files. Is this what you want? Bozena Zdaniuk, Ph.D. University of Pittsburgh UCSUR, 6th Fl. 121 University Place Pittsburgh, PA 15260 Ph.: 412-624-5736 Fax: 412-624-4810 Email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ucal Gyam Sent: Tuesday, March 11, 2008 1:45 PM To: [hidden email] Subject: Comparing DATA 2 files I want to compare two data files FileA and FileB by ID and keep cases where ID in the two files are Identical . Any ideas will be welcomed . Ucal --------------------------------- Looking for last minute shopping deals? Find them fast with Yahoo! Search. ===================== 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 ===================== 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 |
|
In reply to this post by Melissa Ives
Ucal,
This might be a non-destructive way to compare because the two sets of data are merged into one dataset without the possibility of losing any data. Untested but something like: add files file=File1 /in=inFile1 /file=file2 /in=inFile2 . sort cases by ID . aggregate outfile=* mode=addvariables /break id /CntFile1=sum(inFile1) /CntFile2=sum(inFile2) . select if CntFile1>0 and CntFile2>0 . It also might be overkill. Catherine At 3/11/2008 03:42 PM, Melissa Ives wrote: >Ucal, > >The simplest way is to match the files and use the /in subcommand to >create new variables that identify if the source file contributed to the >matched file > >Match files file=A/in=inA/ > files file=B/in=inB/ > by ID. > >*** to check how many matched/didn't match. >Cro tab inA by inB. > >sel if ina=1 and inB=1. > >Melissa > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of >Ucal Gyam >Sent: Tuesday, March 11, 2008 12:45 PM >To: [hidden email] >Subject: [SPSSX-L] Comparing DATA 2 files > >I want to compare two data files FileA and FileB by ID > > and keep cases where ID in the two files are Identical . > > Any ideas will be welcomed . > > Ucal > > >--------------------------------- >Looking for last minute shopping deals? Find them fast with Yahoo! Search. > >===================== >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 |
|
In reply to this post by Zdaniuk, Bozena-2
Bozena,thanks very much for your input, I appreciate it.
"Zdaniuk, Bozena" <[hidden email]> wrote: This is not elegant or parsimonious but in case you don't receive any better advice. 1. create var x1 equal 0 for each id in file1. 2. create var x2 equal 1 for each id in file2. Open file1 and merge in variable x2 from file2 by id. Run a command: SELECT IF (x1=0 and x2=1). Exe. This will retain only the ids that are in both files. Is this what you want? Bozena Zdaniuk, Ph.D. University of Pittsburgh UCSUR, 6th Fl. 121 University Place Pittsburgh, PA 15260 Ph.: 412-624-5736 Fax: 412-624-4810 Email: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ucal Gyam Sent: Tuesday, March 11, 2008 1:45 PM To: [hidden email] Subject: Comparing DATA 2 files I want to compare two data files FileA and FileB by ID and keep cases where ID in the two files are Identical . Any ideas will be welcomed . Ucal --------------------------------- Looking for last minute shopping deals? Find them fast with Yahoo! Search. ===================== 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 --------------------------------- Never miss a thing. Make Yahoo your homepage. ===================== 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 |
