/*This is the variable creation program for "Self-Enforcing Trade Agreements: Evidence from Time-Varying Trade Policy" by Chad P. Bown and Meredith A. Crowley. This project was supported by the research assistance of Aksel Erbahar, Adam Hogan, Xi Luo, and Chrissy Ostrowski. */ *Run this file after SETA-Dataset-compilation-program-05-01-2012.do *This dofile constructs variables to estimate an AD duty and TTB formation model; *The underlying input dataset was constructed by Adam Hogan, Meredith Crowley *and Xi Luo; *The underlying input dataset was re-constructed by Christine Ostrowski with *input from Xi Luo and Meredith Crowley in Summer 2011; cd "C:\mypath" #delimit ; clear; set mem 700m; set more off; use final\NAICS_CNTRY_IMP_AD_elast_EXR_SG.dta, clear; duplicates drop; rename Year year; *Generate a unique real-number identifier for each NAICS industry; *Identify the “modified” 5 digit industries; gen modified=substr(NAICS, 6,1); gen float realnaics=real(NAICS) if modified!= "m"; gen m_naics=substr( NAICS, 1,5) if modified=="m"; gen real_m_naics= real(m_naics); replace realnaics= 88000000+real_m_naics if modified=="m"; *Create a country-industry grouping; egen cntry_ind=group(country realnaics); sort cntry_ind; *Test for duplicates; sort cntry_ind year; quietly by cntry_ind year: gen dup=cond(_N==1,0,_n); tab dup; *No duplicates exist; tsset cntry_ind year, yearly; /*Generate Variables*/ /*Antidumping duty*/ gen ln_duty=ln(1+AD_DUTY); /*Measures of Import Growth*/ *Nominal bilateral imports; gen ln_imp=ln(IMP); gen ln_imp_L1=L1.ln_imp; gen gr_imp=ln_imp-ln_imp_L1; gen gr_imp_L1=L1.gr_imp; gen gr_imp_L2=L2.gr_imp; gen gr_imp_L3=L3.gr_imp; gen avg_imp_L2_L3= (gr_imp_L2+gr_imp_L3)/2; gen unexpect_gr_imp_L1=gr_imp_L1-avg_imp_L2_L3; *Generate a country dummy for China; gen china=1 if country=="China"; replace china=0 if china==.; *Aggregate US imports; sort cntry_ind; tsset cntry_ind year, yearly; egen agg_IMP=sum(IMP), by(NAICS country year); gen ln_agg_imp=ln(agg_IMP); gen ln_agg_imp_L1=L1.ln_agg_imp; gen gr_agg_imp=ln_agg_imp-ln_agg_imp_L1; gen gr_agg_imp_L1=L1.gr_agg_imp; /*Measures of import variability*/ *Standard deviation of bilateral imports; sort cntry_ind; by cntry_ind: egen sd_imp=sd(IMP); by cntry_ind: egen sd_imp_gr=sd(gr_imp); /*Elasticities*/ /* Note: Omega is the INVERSE export supply elastiticity. */ rename ome_med inv_es_elast_med; rename ome_min inv_es_elast_min; rename ome_max inv_es_elast_max; gen es_elast_med=1/inv_es_elast_med; gen es_elast_min=1/inv_es_elast_min; gen es_elast_max=1/inv_es_elast_max; /* Note: Sigma is the import demand (id) elasticity. */ rename sig_med id_elast_med; rename sig_min id_elast_min; rename sig_max id_elast_max; gen inv_id_elast_med=1/id_elast_med; /*Construct the elasticity variable from Bagwell-Staiger (1990), inv(eta_x+eta_m)*/ gen es_id_elast_sum=es_elast_med+id_elast_med; gen inv_es_id_elast_sum = 1/es_id_elast_sum; gen ln_inv_es_id_elast_sum=ln(inv_es_id_elast_sum); /*Domestic industry conditions*/ sort cntry_ind; tsset cntry_ind year, yearly; *HHI is herfindahl; gen ln_hhi=ln(HHindex); *concrat4 is 4 firm concentration ratio; gen ln_concrat4=ln(concrat4); *Industry size; gen ln_totemp=ln(ET); gen ln_totemp_L1=L1.ln_totemp; gen ln_prodemp=ln(PT); gen ln_prodemp_L1=L1.ln_prodemp; *Employment growth; gen gr_totemp=ln_totemp-ln_totemp_L1; gen gr_totemp_L1=L1.gr_totemp; gen gr_prodemp=ln_prodemp-ln_prodemp_L1; gen gr_prodemp_L1=L1.gr_prodemp; *Value-added/output; gen val_out=VA/SH; gen val_out_L1=L1.val_out; *Inventory variables (as a measure of injury); gen inv_ship=I/SH; gen inv_ship_L1=L1.inv_ship; gen ln_inv=ln(I); gen ln_inv_L1=L1.ln_inv; gen gr_inv=ln_inv-ln_inv_L1; gen gr_inv_L1=L1.gr_inv; /*Macroeconomic Variables*/ gen ln_rxr=ln(EXR); gen ln_rxr_L1=L1.ln_rxr; gen chg_rxr=ln_rxr-ln_rxr_L1; gen chg_rxr_L1=L1.chg_rxr ; compress; drop if IMP==. & SH==.; *no empty observations exist; *Generate market share variables; egen naicsyear=group (NAICS year) ; sort naicsyear; by naicsyear: egen total_imp=sum(IMP); sort cntry_ind; tsset cntry_ind year, yearly; gen total_mkt=total_imp+SH; gen ln_total_mkt=ln(total_mkt); gen ln_total_mkt_L1=L1.ln_total_mkt; gen ln_total_mkt_L2=L2.ln_total_mkt; gen gr_total_mkt=ln_total_mkt-ln_total_mkt_L1; gen gr_total_mkt_L1=ln_total_mkt_L1-ln_total_mkt_L2; gen US_mkt_share=SH/total_mkt; gen cnty_i_mkt_sh=IMP/total_mkt; tsset cntry_ind year, yearly; gen US_mkt_share_L1=L1.US_mkt_share; gen US_mkt_share_L2=L2.US_mkt_share; gen US_mkt_share_L3=L3.US_mkt_share; gen US_mkt_share_L4=L4.US_mkt_share; gen cnty_i_mkt_sh_L1=L1.cnty_i_mkt_sh; gen cnty_i_mkt_sh_L2=L2.cnty_i_mkt_sh; gen cnty_i_mkt_sh_L3=L3.cnty_i_mkt_sh; gen cnty_i_mkt_sh_L4=L4.cnty_i_mkt_sh; gen avg_cnty_i_MS_2_4=(cnty_i_mkt_sh_L2 + cnty_i_mkt_sh_L3 +cnty_i_mkt_sh_L4)/3; gen avg_cnty_i_MS_2_3= (cnty_i_mkt_sh_L2+cnty_i_mkt_sh_L3)/2; gen D_US_mkt_sh=US_mkt_share-US_mkt_share_L1; gen D_US_mkt_sh_L1=US_mkt_share_L1-US_mkt_share_L2; gen D_US_mkt_sh_L2=US_mkt_share_L2-US_mkt_share_L3; gen D_cnty_i_mkt_sh=cnty_i_mkt_sh-cnty_i_mkt_sh_L1; gen D_cnty_i_mkt_sh_L1=cnty_i_mkt_sh_L1-cnty_i_mkt_sh_L2; gen D_cnty_i_mkt_sh_L2=cnty_i_mkt_sh_L2-cnty_i_mkt_sh_L3; gen D_cnty_i_mkt_sh_1_3=cnty_i_mkt_sh_L1-cnty_i_mkt_sh_L3; gen dev_cnty_i_MS_2_4=cnty_i_mkt_sh_L1-avg_cnty_i_MS_2_4; gen dev_cnty_i_MS_2_3=cnty_i_mkt_sh_L1-avg_cnty_i_MS_2_3; *generate a variable to capture the change in market share for ROW; sort NAICS year; by NAICS year: egen ms_all_i=sum( cnty_i_mkt_sh); gen ms_all_not_i = ms_all_i - cnty_i_mkt_sh; tsset cntry_ind year, yearly; gen ms_all_not_i_L1=L1.ms_all_not_i; gen ms_all_not_i_L2=L2.ms_all_not_i; gen chg_ms_all_not_i= ms_all_not_i-ms_all_not_i_L1; gen chg_ms_all_not_i_L1=ms_all_not_i_L1-ms_all_not_i_L2; egen country_real=group(country); *Generate interactions between steel, chem and china and x variables; gen gr_imp_L1_china=china*gr_imp_L1; gen sd_imp_china=china*sd_imp_gr; gen D_ms_i_L1_china=china*D_cnty_i_mkt_sh_L1; gen D_ms_row_L1_china=china*chg_ms_all_not_i_L1; /*Create interactions between Lagged import growth and elasticity measures*/ gen MD_XS_imp_L1=gr_imp_L1*ln_inv_es_id_elast_sum; save "SETA_estim_final_05-01-2012.dta", replace;