Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: merging datasets


From   Χρυσούλα Γιαννικοπούλου <chrygiann@gmail.com>
To   statalist@hsphsun2.harvard.edu
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
                   1998

ESB08674384        ESA08685471        BARNA CONSHIPPING S.L.       ES
                  2000

ESB61477196       ESA08685471         BARNA  SA
         ES                  2005

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

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

EE10366713                                           ESA08685471
                                   31818.2                         ES


NO936796702                                            1851.9
                NO
US78-689-8726
NO964052131                                         IT28965
                                        15584.89
IT
.
.
.

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"

clear

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
r(459);

*************


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!!

Chrysa
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index