SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  data not merging correctly with one-to-one key variables

    Posted Thu September 07, 2023 02:05 PM
      |   view attached

    Hi all, 

    I hope your day is going well.

    I am trying to merge two data sets- the primary set has the correct/desired amount of rows/ cases (298) and the second set I am merging into it has extra cases (350), the ones which don't match to the 298 document of which I am hoping will be discarded once the merge occurs. The two key variables/ columns have the same IDs as far as I can tell, and yet when I try to merge them the data gets totally scattered and out of whack/alignment. I compared the two docs and got a 99% mismatch rate and am confused on what that means/where to go from here. I attached a picture of the comparison results for clarification. Sorry if this isn't the right forum- thanks in advance!



    ------------------------------
    Caroline Webb
    ------------------------------



  • 2.  RE: data not merging correctly with one-to-one key variables

    Posted Thu September 07, 2023 02:31 PM

    i'm guessing you're using /file instead of /table.  /file will contain all records even ones without a match.  /table will only merge records that are contained on the left table.



    ------------------------------
    Art Jack
    ------------------------------



  • 3.  RE: data not merging correctly with one-to-one key variables

    Posted Fri September 08, 2023 01:10 PM

    Hi @Caroline Webb
    See the online documentation for one to one merges, and the MATCH FILES command syntax

    As you'll see in the "one to one" examples all of the MATCH FILES commands are using the /FILE subcommand only.
    You are likely doing a "one to many" type of merge where one file contributes cases, and the other is a table lookup.  The /FILE subcommand always contributes its cases to the resulting file.  The /TABLE subcommand contributes unique new variables based upon the unique combinations of the Key variable(s).

    I hope this helps!



    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software
    ------------------------------



  • 4.  RE: data not merging correctly with one-to-one key variables

    Posted Fri September 08, 2023 01:24 PM

    Hi-

    This fixed the issue!

    Thank you so so much! 



    ------------------------------
    Caroline Webb
    ------------------------------