spmon wecon , w(fdiinstocknoneg_usd2000) i(host) k(rep) time(year) sename(weconfdiinstockslrowst) spmon wecon , w(tradei_usd2000) i(host) k(rep) time(year) sename(wecontradeslrowst) spmon wosoc , w(fdiinstocknoneg_usd2000) i(host) k(rep) time(year) sename(wosocfdiinstockslrowst) spmon wosoc , w(tradei_usd2000) i(host) k(rep) time(year) sename(wosoctradeslrowst) collapse weconfdiinstockslrowst wecontradeslrowst wosocfdiinstockslrowst wosoctradeslrowst2, by(host year) ren host country save "spatial lags.dta", replace *** These spatial lags are then merged into the estimation dataset *** via 'mmerge country year using "spatial lags.dta"'.