search across all the following databases:
Data and documentation
Common questions and answers.
Entire collection of data resources.
I am trying to merge a file with some restricted use items with the public use version of the data. I'm using stata. When I run the merge, I got a message saying "merge already defined."
Is this because some of the variable names are the same?
No. The message from stata says "_merge already defined."
_merge is an item that stata creates after a merge. It gives the user input on the outcome of the merge.
The possible values for _merge are:
1 - Observations from the master dataset that did not match observations from the using dataset
2 - Observations from the using dataset that did not match observations from the master dataset
3 - Observations from both datasets that did match
After looking at _merge you should either drop the item (drop _merge) or rename it (rename _merge merge1) as stata will not write over the existing _merge variable.