I have a panel dataset of exchange rate with 200 countries and 16 years, please find below an example:
country_origin | year | variable1 |
Albania | 2006 | 98.1 |
Albania | 2007 | 90.43 |
Albania | 2008 | 83.89 |
Argentine | 2006 | 3.05 |
Argentine | 2007 | 3.1 |
Argentine | 2008 | 3.14 |
Egypt | 2006 | 5.73 |
Egypt | 2007 | 5.64 |
Egypt | 2008 | 5.43 |
I want to create a bilateral exchange rate dataset. It should look like this for example (as if I am replicating the same dataset but for each panel and I end up creating two variables: country_destination and variable1_replicated):
country_origin | year | variable1 | country_destination | variable1_replicated |
Albania | 2006 | 98.1 | Albania | 98.1 |
Albania | 2007 | 90.43 | Albania | 90.43 |
Albania | 2008 | 83.89 | Albania | 83.89 |
Albania | 2006 | 98.1 | Argentine | 3.05 |
Albania | 2007 | 90.43 | Argentine | 3.1 |
Albania | 2008 | 83.89 | Argentine | 3.14 |
Albania | 2006 | 98.1 | Egypt | 5.73 |
Albania | 2007 | 90.43 | Egypt | 5.64 |
Albania | 2008 | 83.89 | Egypt | 5.43 |
Argentine | 2006 | 3.05 | Albania | 98.1 |
Argentine | 2007 | 3.1 | Albania | 90.43 |
Argentine | 2008 | 3.14 | Albania | 83.89 |
Argentine | 2006 | 3.05 | Argentine | 3.05 |
Argentine | 2007 | 3.1 | Argentine | 3.1 |
Argentine | 2008 | 3.14 | Argentine | 3.14 |
Argentine | 2006 | 3.05 | Egypt | 5.73 |
Argentine | 2007 | 3.1 | Egypt | 5.64 |
Argentine | 2008 | 3.14 | Egypt | 5.43 |
Egypt | 2006 | 5.73 | Albania | 98.1 |
Egypt | 2007 | 5.64 | Albania | 90.43 |
Egypt | 2008 | 5.43 | Albania | 83.89 |
Egypt | 2006 | 5.73 | Argentine | 3.05 |
Egypt | 2007 | 5.64 | Argentine | 3.1 |
Egypt | 2008 | 5.43 | Argentine | 3.14 |
Egypt | 2006 | 5.73 | Egypt | 5.73 |
Egypt | 2007 | 5.64 | Egypt | 5.64 |
Egypt | 2008 | 5.43 | Egypt | 5.43 |
I was wondering if there could be any command that would help execute this format. I would be grateful if you could advise on this. I am sorry in advance if this has been asked before and I couldn't locate the answer.
Many thanks in advance.
Jala Youssef
0 Response to Panel data: Creating a bilateral dataset with countries and years (replicating the dataset for each panel)
Post a Comment