Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: merging datasets

From   Χρυσούλα Γιαννικοπούλου <>
Subject   st: merging datasets
Date   Wed, 18 Aug 2010 17:16:30 +0200

Hello Statalist,

I am facing with a problem in merging 2 different datasets. I let you
know that I use Stata 11.

Both of the datasets have 13  variables each.

I would like to merge them according to the variable "bvdep_id_mother" .

For example, data look like:

Dataset A
bvdep_id                bvdep_id_mother     company_name
          country              Year      ........

ESA58527060        ESA08685471        TREFILERIAS QUIJANO SA        ES

ESB08674384        ESA08685471        BARNA CONSHIPPING S.L.       ES

ESB61477196       ESA08685471         BARNA  SA
         ES                  2005

ESA58527060        ESA08685471        TREFILERIAS QUIJANO SA        ES
For this dataset the bvdep_id_mother is the same for all observations.

Dataset B
bvdep_id_mother(acquirorbvdepidnumber)   dealvalue
  country ........

EE10366713                                           ESA08685471
                                   31818.2                         ES

NO936796702                                            1851.9
NO964052131                                         IT28965

Here, bvdep_id_mother is named acquirorbvdepidnumber and differs
accross obsarvations.

I tried this:


set mem 500m

use "B.dta"

rename  acquirorbvdepidnumber bvdep_id_mother

sort bvdep_id_mother

save  "B.dta"


set mem 500m

use "A.dta"

sort bvdep_id_mother

merge 1:m bvdep_id using "B.dta"


Finally, I have the error message:
variable bvdep_id does not uniquely identify observations in the master data


I have the same problem even if I give the command merge m:1 or even
if I use as master dataset the "b.dta"

Could you help me please? What do I do in a wrong way?

Many thanks in advance!!

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index