Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Merging dyadic panel data

From   Sam Gluck <>
Subject   st: Merging dyadic panel data
Date   Mon, 5 Dec 2011 15:14:10 +0000

Dear Statalisters, I have what I suspect is a real monster of a
problem, and I don't really know where to start.

I have two datasets on international trade, both country-pair X time
datasets in long form. Dataset1 looks like:

Unique_country-pair_ID     country1_name    country2_name   year
bilattrade   indepvars

bilattrade is a an average of import and export flows between the two
countries, so there's only a single observation on each country-pair
for a given year.

Dataset2 contains observations on an (almost identical) set of
countries over an (almost identical) time period. It looks like this:

Importer_country    exporter_country     year    trade_value

The difference here is that dataset2 splits the trade between a
country pair in a given year into two observations - (exports from i
to j) and (imports to i from j)

What I wish to do is take the indepvars from dataset1 and combine them
with the disaggregated trade value data from dataset2.

What seems obvious is that I need to somehow get the unique pair-IDs
into the second data set. There are over 12,000 unique observations on
that particular variable, however.

The other problem is, of course, that the countries in either dataset
are not exactly the same and that I need to drop those countries that
do not appear in both data sets in the same years. Is there some stata
command that would help with this?

Any help would be greatly appreciated...

Sam Gluck
*   For searches and help try:

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