Hi all,
Relatively new to stata. I'm using Stata 18 on windows. I'm working on bilateral pairs within free trade agreements. I've created these country pairs (both ways) with some information contained in several variables (EnvProvs_Total EnvProvs_Sub FTA) I will like to create multiple export products (about 160) for each country pair for each of the 21years (ranging from 2000-2020.) For each of this newly generated rows, I will like to keep the same information, depending on the variable Year_Force. For those years before 2000, I will assume they take effect in 2000 and retain the information in those variables (EnvProvs_Total EnvProvs_Sub FTA) but for those after 2000, I'd like the information retained only from the year they took effect. For the previous years, id like to equate them to zero as well as edit some of them to specific values.
Please find below the example dataset;
Please is anyone able to help out?
Many thanks.
Relatively new to stata. I'm using Stata 18 on windows. I'm working on bilateral pairs within free trade agreements. I've created these country pairs (both ways) with some information contained in several variables (EnvProvs_Total EnvProvs_Sub FTA) I will like to create multiple export products (about 160) for each country pair for each of the 21years (ranging from 2000-2020.) For each of this newly generated rows, I will like to keep the same information, depending on the variable Year_Force. For those years before 2000, I will assume they take effect in 2000 and retain the information in those variables (EnvProvs_Total EnvProvs_Sub FTA) but for those after 2000, I'd like the information retained only from the year they took effect. For the previous years, id like to equate them to zero as well as edit some of them to specific values.
Please find below the example dataset;
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str44 Exporter int ExpCode str3 ExpISO str44 Importer int ImpCode str3 ImpISO str12 Year_Force byte(EnvProvs_Total EnvProvs_Sub FTA) "ANTIGUA AND BARBUDA" 28 "ATG" "ESTONIA" 233 "EST" "2008" 23 7 1 "BONAIRE, SINT EUSTATIUS AND SABA" 535 "BES" "IRELAND" 372 "IRL" "1971" 13 5 1 "BULGARIA" 100 "BGR" "UKRAINE" 804 "UKR" "2014" 33 7 1 "CYPRUS" 196 "CYP" "PORTUGAL" 620 "PRT" "2014" 34 7 1 "CYPRUS" 196 "CYP" "SWITZERLAND" 756 "CHE" "1973" 1 1 1 "ESTONIA" 233 "EST" "UNITED KINGDOM" 826 "GBR" "2014" 34 7 1 "FINLAND" 246 "FIN" "NICARAGUA" 558 "NIC" "2013" 32 7 1 "FRANCE" 250 "FRA" "MOLDOVA" 498 "MDA" "2014" 34 7 1 "INDIA" 356 "IND" "MALAYSIA" 458 "MYS" "2011" 4 2 1 "INDIA" 356 "IND" "URUGUAY" 858 "URY" "2009" 4 3 1 "ISRAEL" 376 "ISR" "SWITZERLAND" 756 "CHE" "1993" 3 3 1 "KENYA" 404 "KEN" "BURUNDI" 108 "BDI" "1994" 24 7 1 "MADAGASCAR" 450 "MDG" "CONGO DR" 180 "COD" "1994" 24 7 1 "PALESTINE" 275 "PSE" "AUSTRIA" 40 "AUT" "1997" 12 5 1 "PERU" 604 "PER" "SINGAPORE" 702 "SGP" "2017" 34 7 1 "SAINT VINCENT AND THE GRENADINES" 670 "VCT" "AUSTRIA" 40 "AUT" "2008" 23 7 1 "SERBIA" 688 "SRB" "NETHERLANDS" 528 "NLD" "2010" 17 6 1 "SUDAN" 729 "SDN" "BAHRAIN" 48 "BHR" "1998" 2 2 1 "SWITZERLAND" 756 "CHE" "GREECE" 300 "GRC" "1973" 1 1 1 "ZAMBIA" 894 "ZMB" "LIBYA" 434 "LBY" "1994" 24 7 1 end
Please is anyone able to help out?
Many thanks.
Comment