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: merge bilateral panel data


From   Andreas Dimopoulos <[email protected]>
To   <[email protected]>
Subject   Re: st: merge bilateral panel data
Date   Thu, 03 Apr 2014 22:23:40 +0100

That seems to be  working!

Many thanks,
Andreas


On Thu, 3 Apr 2014 16:56:41 -0400, Alfonso Sánchez-Peñalver
<[email protected]> wrote:
> On your first dataset, does the reporter/year pair provide a unique
> observation? Also, what version of Stata are you using, because if its
> prior to 11 the syntax is different. Ill assume that you are using Stata
11
> or later, and that the reporter/year pair provides a unique observation
in
> the first dataset.
> 
> First have both datasets sorted by reporter year (sort reporter year).
Let
> us call dataset 1 ds1, and dataset 2 ds2. Have ds1 in memory, i.e. open
in
> Stata. The command you want is
> 
> merge 1:m reporter year using ds2
> 
> Let me know if that works. Best,
> 
> Alfonso Sánchez-Peñalver, PhD
> 
> Visiting Assistant Professor
> Suffolk University
> Senior Instructor
> UMass Boston
> 
> 
> 
> On Apr 3, 2014, at 4:35 PM, Andreas Dimopoulos <[email protected]>
wrote:
> 
>> hello,
>> 
>> I am trying to merge two panel datasets where the one has each country
>> for
>> different number of years and the relevant characteristics and another
>> dataset with pair of countries and their in-between trade. For example,
>> 
>> Dataset 1:
>> 
>> reporter      year var1 
>> Alb           2000 x1
>> Alb           2002 x2
>> .               .   .
>> .               .   .
>> .               .   .
>> Can           2000 X67
>> Can           2003 X68
>> 
>> My second dataset has again panel data but with pairs of countries
>> 
>> reporter partner year trade 
>> 
>> alb       arg     2003  k
>> alb       aus     2000  k1
>> alb       aus     2002  k2
>> .          .       .    .
>> .          .       .    .
>> .          .       .    .
>> can       ken     2000  m
>> can       ken     2004  m2
>> 
>> I tried to merge the data after I had used the command "sort". However,
>> stata said that reporter cannot uniquely identify observations which I
>> understand since I have the pairs of countries two, three,four  times
>> etc.
>> depending on the years...Any ideas of how to merge?
>> 
>> Thanks a lot,
>> A
>> *
>> *   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