Bookmark and Share

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]

RE: st: RE: merging - unique observations


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: RE: merging - unique observations
Date   Sun, 6 Apr 2014 12:02:36 +0000

The fact that there are country-pairs in the second data set that don't have corresponding observations in the first data set shouldn't cause any problem. You can get rid of those observations if you wish:

. use first
. merge m:1 reporter partner using second
. drop if _merge==2

________________________________________
From: [email protected] [[email protected]] on behalf of Andreas Dimopoulos [[email protected]]
Sent: Sunday, April 06, 2014 12:33 AM
To: [email protected]
Subject: Re: st: RE: merging - unique observations

My first dataset is like:

reporter partner period trade
can       usa      2000   k1
can       usa      2002   k2

and my second dataset is like:

reporter partner  distance
can        usa     x1
can        arg     x2

A difference between the datasets is that the second one has every pair of
countries in the sample while the first one not. For example, the pair
CAN-ARG does not exist in the first one. Hope that helps?

Regards,
A


On Sun, 6 Apr 2014 00:35:33 +0000, Joe Canner <[email protected]> wrote:
> Andrew,
>
> It is difficult to say for sure what the problem is without more details
> about your data, what command(s) you ran, and the exact error message
you
> received.
>
> However, it appears that at least one of the problems is that your first
> data set has multiple observations per country-pair (one for each year)
> while the second data set has only one observation per country-pair.  If
> this is the case, try a many-to-one merge:
> . merge m:1 countrypair using distancedata
>
> I can also imagine other problems that might arise from the use of
> country-pairs as the merging key, but we would have to know more about
your
> data in order to diagnose them.
>
> Regards,
> Joe Canner
> Johns Hopkins University School of Medicine
>
> ________________________________________
> From: [email protected]
> [[email protected]] on behalf of Andreas Dimopoulos
> [[email protected]]
> Sent: Saturday, April 05, 2014 5:47 PM
> To: [email protected]
> Subject: st: merging - unique observations
>
> Good evening,
>
> I have two datasets where the first one contains pairs of countries and
> their in between trade for different years and another dataset which has
> the pair of countries and their in between distance etc (which don't
change
> over time). I tried to merge those two datasets based on the things I
have
> read but stata tells me that the observations cannot be uniquely
> identified.
>
> Any piece of advise?
>
> Regards,
> Andrew
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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