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 at the end of May, and its replacement, statalist.org is already up and running.


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

AW: st: merging datasets


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: st: merging datasets
Date   Thu, 19 Aug 2010 18:03:35 +0200

<> 

The -merge- syntax changed (fundamentally) between Stata 10 and 11, so look up the correct syntax in the help file...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Wenxia Ge
Gesendet: Donnerstag, 19. August 2010 17:52
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: merging datasets

Hi Neil,

I am using Stata 10. When I use "merge m:1 var1 var2 using t1",  I
will get the following error information "variable m not found" . When
I use "merge 1:m var1 var2 using t2" command, then get this error
message "1 invalid name". So I am just wondering how to make "merge
m:1" or "merge 1:m" work?

Thanks.

Wenxia

2010/8/18 Χρυσούλα Γιαννικοπούλου <chrygiann@gmail.com>:
> 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/
>

*
*   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/


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