Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Expanding dataset


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   st: Expanding dataset
Date   Sat, 14 Feb 2004 19:42:19 -0000

I have a dataset with bilateral trade data as follows:

Country1  Country2     year         btrade
US            Arg            1950         x1
US            Arg            1951         x2
US            Bra            1949         x3
US            Can            1949        x4
US            Can            1950        x5
US            Can            1951        x6
US            Col             1950        x7
US            Chile           1950        x9
US            Mex            1950        x10
Arg            Bra             1950        x11
Arg            Can            1951        x12



Chile        Mex             1952        xN

Notice that the last of country2 (Mex) wont appear as a country1 and that
the first of country1 (US) wont appear as country2.

Want I want to do is to expand the dataset in order to have all possible
combinations of country1 and country2 for each country in the sample. The
dataset I'm looking for should look like the following one:

Country1  Country2     year         btrade
US            Arg            1950         x1
US            Arg            1951         x2
US            Bra            1949         x3
US            Can            1949        x4
US            Can            1950        x5
US            Can            1951        x6
US            Col             1950        x7
US            Chile           1950        x9
US            Mex            1950        x10
Arg            Bra             1950        x11
Arg            Can            1951        x12


Arg           US              1950        x1
Arg            US             1951        x2


Chile        Mex             1952        xN


Mex        US                1950        x10

Thanks,

Rafa
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index