Hello,
I am building a bilateral dataset on trade measures that countries take against one another. As you can see in the example, each observation consists of an Imelepemnting Jurisdiction (country) + its ID and affected Jurisdiction (country) + its ID. Obviously, the ID for each country must be consistent across the dataset. For example, if Aghanistan has ID=1 as an implementing country, it must also have the same ID if it is affected.
I created a unique ID for each country by
encode ImplementingJurisdiction, gen(country)
But I do not know how to use it or assign it as a variable (let's say "countryid_Affctd") as a column sided by the Affected county (or affected Jurisdiction)
I am building a bilateral dataset on trade measures that countries take against one another. As you can see in the example, each observation consists of an Imelepemnting Jurisdiction (country) + its ID and affected Jurisdiction (country) + its ID. Obviously, the ID for each country must be consistent across the dataset. For example, if Aghanistan has ID=1 as an implementing country, it must also have the same ID if it is affected.
I created a unique ID for each country by
encode ImplementingJurisdiction, gen(country)
But I do not know how to use it or assign it as a variable (let's say "countryid_Affctd") as a column sided by the Affected county (or affected Jurisdiction)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float countryid_implmt long Impl_Jur float countryid_Affctd long Aff_Jur float(year countryid) long country . 1 . . 2008 . . . 1 . . 2009 . . 1 1 . 148 2010 1 1 1 1 . 154 2010 1 1 1 1 . 148 2011 1 1 1 1 . 154 2011 1 1 1 1 . 148 2012 1 1 1 1 . 154 2012 1 1 1 1 . 154 2013 1 1 1 1 . 148 2013 1 1 1 1 . 148 2014 1 1 1 1 . 154 2014 1 1 1 1 . 148 2015 1 1 1 1 . 154 2015 1 1 1 1 . 148 2016 1 1 1 1 . 154 2016 1 1 1 1 . 148 2017 1 1 1 1 . 154 2017 1 1 1 1 . 154 2018 1 1 1 1 . 148 2018 1 1 1 1 . 154 2019 1 1 1 1 . 148 2019 1 1 1 1 . 154 2020 1 1 1 1 . 148 2020 1 1 . 1 . . 2021 . . . 1 . . 2022 . . . 1 . . 2023 . . . 1 . . 2024 . . . 1 . . 2025 . . . 1 . . 2028 . . . 1 . . . . . . 2 . . 2008 . . 2 2 . 76 2009 2 2 2 2 . 213 2009 2 2 2 2 . 166 2009 2 2 2 2 . 118 2009 2 2 2 2 . 98 2009 2 2 2 2 . 78 2009 2 2 2 2 . 42 2009 2 2 2 2 . 221 2009 2 2 2 2 . 92 2009 2 2 2 2 . 98 2010 2 2 2 2 . 92 2010 2 2 2 2 . 76 2010 2 2 2 2 . 166 2010 2 2 2 2 . 221 2010 2 2 2 2 . 78 2010 2 2 2 2 . 118 2010 2 2 2 2 . 213 2010 2 2 2 2 . 42 2010 2 2 2 2 . 42 2011 2 2 2 2 . 78 2011 2 2 2 2 . 92 2011 2 2 2 2 . 118 2011 2 2 2 2 . 166 2011 2 2 2 2 . 98 2011 2 2 2 2 . 221 2011 2 2 2 2 . 213 2011 2 2 2 2 . 76 2011 2 2 2 2 . 166 2012 2 2 2 2 . 42 2012 2 2 2 2 . 222 2012 2 2 2 2 . 118 2012 2 2 2 2 . 98 2012 2 2 2 2 . 92 2012 2 2 2 2 . 78 2012 2 2 2 2 . 221 2012 2 2 2 2 . 213 2012 2 2 2 2 . 162 2012 2 2 2 2 . 76 2012 2 2 2 2 . . 2012 2 2 2 2 . 49 2013 2 2 2 2 . 214 2013 2 2 2 2 . 185 2013 2 2 2 2 . 97 2013 2 2 2 2 . 42 2013 2 2 2 2 . 98 2013 2 2 2 2 . 222 2013 2 2 2 2 . 162 2013 2 2 2 2 . 213 2013 2 2 2 2 . 52 2013 2 2 2 2 . 221 2013 2 2 2 2 . 31 2013 2 2 2 2 . 92 2013 2 2 2 2 . 14 2013 2 2 2 2 . 36 2013 2 2 2 2 . . 2013 2 2 2 2 . 76 2013 2 2 2 2 . 78 2013 2 2 2 2 . 118 2013 2 2 2 2 . 170 2013 2 2 2 2 . 166 2013 2 2 2 2 . 97 2014 2 2 2 2 . 170 2014 2 2 2 2 . 31 2014 2 2 2 2 . 52 2014 2 2 2 2 . 221 2014 2 2 2 2 . 185 2014 2 2 2 2 . 49 2014 2 2 2 2 . 213 2014 2 2 end label values Impl_Jur Impl_Jur label def Impl_Jur 1 "Afghanistan", modify label def Impl_Jur 2 "Albania", modify label values Aff_Jur Aff_Jur label def Aff_Jur 14 "Azerbaijan", modify label def Aff_Jur 31 "Bulgaria", modify label def Aff_Jur 36 "Canada", modify label def Aff_Jur 42 "China", modify label def Aff_Jur 49 "Croatia", modify label def Aff_Jur 52 "Czechia", modify label def Aff_Jur 76 "Germany", modify label def Aff_Jur 78 "Greece", modify label def Aff_Jur 92 "India", modify label def Aff_Jur 97 "Israel", modify label def Aff_Jur 98 "Italy", modify label def Aff_Jur 118 "Macedonia", modify label def Aff_Jur 148 "Nigeria", modify label def Aff_Jur 154 "Pakistan", modify label def Aff_Jur 162 "Poland", modify label def Aff_Jur 166 "Republic of Korea", modify label def Aff_Jur 170 "Russia", modify label def Aff_Jur 185 "Serbia", modify label def Aff_Jur 213 "Turkey", modify label def Aff_Jur 214 "Turkmenistan", modify label def Aff_Jur 221 "United Kingdom", modify label def Aff_Jur 222 "United States of America", modify label values country country label def country 1 "Afghanistan", modify label def country 2 "Albania", modify
Comment