Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: merging datasets
From
Χρυσούλα Γιαννικοπούλου <[email protected]>
To
[email protected]
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/