/* This do file replaces the assigned industry for industries that were either a little questionable since they were done algorithmically or not assigned at all, and thus were handchecked. */ if "`1'"==""{ global CMF_pipeline "../.." } global industry "${CMF_pipeline}/5_industry_assignment" *Go through the years 1850-1870 and 1880 general schedule and potentially correct the assigned industry foreach year in 1850 1860 1870 1880_general_schedule{ use "${industry}/output/`year'_industry_assigned", clear merge m:1 industry_raw using "${industry}/intermediate_files/hand_checked_crosswalk.dta", keep(1 3) for x in any detailed broadest leontief granular: replace ind_x = ind_x_new if _m==3 drop ind_detailed_new ind_broadest_new ind_leontief_new ind_granular_new _m *now fill in unsassigned establishments with unclassified/mising gen unclassified=ind_leontief=="" for x in any detailed granular leontief broadest : replace ind_x="unclassified" if unclassified==1 drop unclassified save "${industry}/output/`year'_industry_assigned", replace }