Announcement

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

  • Dealing with error note r(110) after merge command

    Hi Statalist

    I have successfully merged 5 separate datasets from a longitudinal study using the same identifier. But I've hit a wall!

    Below is an example of one of my latest merge requests which appears to be failing with a "_merge already defined r(110)" error message.

    merge 1:1 id_ using merge 1:1 id_ using "H:\a_PhD\A_Thesis\STATA\New BMI Z WHO2007 6 to 11.dta"

    The error note r(110) states:
    "A variable or a value label has already been defined, and you attempted to redefine it. This occurs most often with generate. If you really intend to replace the values, use replace. If you intend to replace a value label, specify the replace option with the label define command. If you are attempting to alter an existing label, specify the add or modify option with the label define command."

    1) none of the existing or to-be-merged variables or value labels, are defined similarly.
    2) I dont want to replace or modify any existing labels.
    3) In trying to respond to this error, I have renamed all relevant variables and changed value labels on both datasets but keep getting this error message!

    Any advice would be great.

    Thank you.
    Sila
    Last edited by Sila Savila; 20 Nov 2016, 20:25. Reason: After working on this merge for 1 week somehow I've done enough manipulation of the variables and value labels for Stata to accept the merge.

  • #2
    Why would you have two merge statements in the same line? Of course this would blow up.
    Make sure you don't have _merge in either data set. There are created automatically when you merge and it easy to forget to delete them before the next merge.

    Comment


    • #3
      In addition to Phil Bromiley's excellent advice, you can suppress the creation of the _merge variable by specifying the -nogenerate- option in your -merge- command. (But only do this if you are quite sure what assortment of match master and using observations will result from your merge--preferably by including the corresponding -assert()- option. If the merge doesn't work out as expected you need to know about that before blundering on.)

      Comment

      Working...
      X