I am trying to replace country pair value equal to other countries pai. I start presenting my data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str5(exp imp) double regulatory_distance float(eu_imp eu_exp) double year "EST" "MAR" . 0 1 2010 "EST" "MAR" . 0 1 2009 "EST" "CZE" 0 1 1 2007 "EST" "HUN" 0 1 1 2011 "EST" "CRI" . 0 1 2006 "EST" "SVK" 0 1 1 2006 "EST" "CAN" . 0 1 2009 "EST" "ROU" 0 1 1 2005 "EST" "IND" . 0 1 2015 "EUN" "SGP" . 0 0 2006 "EUN" "VNM" .21107634373645426 0 0 2012 "EUN" "MEX" . 0 0 2005 "EUN" "CHN" .23667761891316066 0 0 2013 "EUN" "MYS" .19354031367918476 0 0 2013 "EUN" "SAU" . 0 0 2007 "EUN" "HKG" . 0 0 2005 "EUN" "CHN" . 0 0 2008 "EUN" "USA" .210032856739482 0 0 2013 "EUN" "PER" . 0 0 2006 "EUN" "JPN" .1901904664116847 0 0 2013 "EUN" "JPN" .14459803162667256 0 0 2009 "EUN" "RUS" .17608094928478543 0 0 2012 "EUN" "BRA" . 0 0 2008 "EUN" "MAR" .18337087675925984 0 0 2014 "EUN" "SGP" . 0 0 2005 "EUN" "KAZ" . 0 0 2005 "EUN" "TUR" . 0 0 2006 "EUN" "BRA" .26726403337667964 0 0 2012 "EUN" "NZL" .19415772648461205 0 0 2012 "EUN" "TUR" . 0 0 2011 "EUN" "HKG" .15265029296665403 0 0 2010 "EUN" "MAR" .17806539878630256 0 0 2012 "EUN" "SGP" . 0 0 2008 "EUN" "CHE" .24210785369305074 0 0 2015 "EUN" "BRN" . 0 0 2011 "EUN" "BRA" . 0 0 2005 "EUN" "BRN" .19716259545337608 0 0 2014 "EUN" "PER" . 0 0 2005 "EUN" "NZL" . 0 0 2008 "EUN" "BRA" .24336319068155848 0 0 2009 "EUN" "KHM" .21902091460771564 0 0 2012 "EUN" "PHL" . 0 0 2005 "EUN" "BRN" . 0 0 2006 "EUN" "NZL" . 0 0 2007 "EUN" "THA" .18668583434700872 0 0 2009 "EUN" "PHL" .21881440920417142 0 0 2015 "EUN" "HKG" . 0 0 2008 "EUN" "USA" .1983230431329904 0 0 2010 "EUN" "PER" .2220855739124433 0 0 2014 "EUN" "CHL" .1847298981361075 0 0 2012 "EUN" "KOR" .14552465713243237 0 0 2010 end
regulatory distance is a bilateral index that ranges from 0 to 1; eu_imp (eu_exp) is a dummy variable equal to 1 if the importer (exporter) is a European country, 0 otherwise. The problem is that this index (regulatory distance) does present values for European Union as a whole (EUN) but it does not for single European countries (ex: EST, ITA, FRA,...). Thus, I would like to replace the bilateral value of all European importers (eu_imp =1) equal to the correspondent bilateral values for EUN. For instance, from this:
importer | exporter | regulatory distance | eu_imp | eu_exp | year |
ITA | USA | . | 1 | 0 | 2010 |
ITA | ZAF | . | 1 | 0 | 2010 |
RUS | USA | 0.46 | 0 | 0 | 2010 |
EUN | USA | 0.25 | 1 | 0 | 2010 |
EUN | ZAF | 0.36 | 1 | 0 | 2010 |
to this
importer | exporter | regulatory distance | eu_imp | eu_exp | year |
ITA | USA | 0.25 | 1 | 0 | 2010 |
ITA | ZAF | 0.36 | 1 | 0 | 2010 |
RUS | USA | 0.46 | 0 | 0 | 2010 |
EUN | USA | 0.25 | 1 | 0 | 2010 |
EUN | ZAF | 0.36 | 1 | 0 | 2010 |
I am really confused about how to get this result. Since I have been stuck on this for a long time, I hope there is someone who can help to solve this issue.
0 Response to Replacing bilateral values
Post a Comment