Hello everyone,
I am trying to run replace values for a variable "applied_tariff" based on conditions. However, every time I run the code I get (slightly) different estimates for the variable applied_tariff. I cannot really understand the source of this problem and how to fix it. I hope some of you will be willing to help.
I attach here the dataset that I am using (on GoogleDrive) and also the code for those that want to try to run the code.
This problem has been puzzling me a lot, so I sincerely thank you in advance for your time.
I am trying to run replace values for a variable "applied_tariff" based on conditions. However, every time I run the code I get (slightly) different estimates for the variable applied_tariff. I cannot really understand the source of this problem and how to fix it. I hope some of you will be willing to help.
I attach here the dataset that I am using (on GoogleDrive) and also the code for those that want to try to run the code.
Code:
// When missing, I replace bilateral tariffs with that of EU when a EU member is exporter and the importer is a non EU-member gen exp2= cond(eu_exp, "EUN", exp) bys exp2 imp ISIC3 year (applied_tariff): replace applied_tariff= applied_tariff[_n-1] if missing(applied_tariff) & exp!="EUN" & exp2=="EUN" // When missing, I replace bilateral tariffs when a EU member is importer and the exporter is a non EU-member gen imp2= cond(eu_imp, "EUN", imp) bys imp2 exp year (applied_tariff): replace applied_tariff= applied_tariff[_n-1] if missing(applied_tariff) & imp!="EUN" & imp2=="EUN" drop if exp == "EUN" | imp == "EUN" drop _fillin eu_exp eu_imp exp2 imp2 decode ISIC3, gen(sect_string) mdesc replace sect_string = "32" if ISIC3 ==32 replace sect_string = "33" if ISIC3 ==33 replace sect_string = "34" if ISIC3 ==34 replace sect_string = "35" if ISIC3 ==35 replace sect_string = "36" if ISIC3 ==36 // I compare summary statistics and missing values wrt to the last time I run the code sum applied_tariff mdesc applied_tariff
This problem has been puzzling me a lot, so I sincerely thank you in advance for your time.
Comment