Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Merge Issues

    Hello,

    My name is Omolola.

    I need help to sort out my merge issues, I have tried out different techniques, yet the result is not successful

    merge 1:m uniqueid using "C:\Users\LOLA\Dropbox\PhD\Post-Field\Data Analysis\Processed Data\M
    > erged Edits\hhqedit.dta"
    (label uniqueid already defined)

    Result Number of obs
    -----------------------------------------
    Not matched 7,087
    from master 7,087 (_merge==1)
    from using 0 (_merge==2)

    Matched 1,437 (_merge==3)
    -----------------------------------------

    The variables that uniquely identify my data are migration status, household id, household member id, region, and enumeration area. So, I generated a unique id using this command

    ///// Concatenate the variables to create a variable

    gen unique_id = hh_str + "_" + ea_str + "_" + hhmid_str + "_" + migridpstr + "_" + region

    It doesn't merge successfully, am I doing something wrong? I appreciate your support. Thank you.

    For context, I am using a survey data - Nigeria IDP survey by World Bank.

    Thank you

  • #2
    try

    Code:
    joinby hh_str  ea_str  hhmid_str  migridpstr  region using "C:FILE" , unmatched(master) 
    tab _merge

    Comment


    • #3
      In what sense was your -merge- unsuccessful? You don't have any error message generated. Do you mean that you expected all observations in the two data sets to match?

      If that is the case, then I think the problem is most likely that your data are not what you think they are. You need to look at the unmatched observations (-browse if _merge != 3-) Then search through the data in hhqedit for observations in the data that you think should match them. You won't find any, of course, but you may uncover observations that are "nearly" matches and fail to match due, perhaps, to differences in spelling, capitalization, punctuation, or something like that. Without any example data to look it, it is hard to say just what is going wrong.

      If you need further assistance, post back showing example data from both data sets. Choose the examples to include some observations that you think should be matched but aren't. And use the -dataex- command to show the examples. If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

      Added: Crossed with #2.

      Comment

      Working...
      X