Hi there,

I am currently trying to replicate an empirical study that uses a regression model with the reghdfe package. It incorporates a two-way cluster and industry specific fixed effects. After installing reghdfe, I try to establish the fixed effects with the inrange command. Followed up by clustering the standard errors with the eststo command and the cluster2 command. Subsequently, Stata is omitting nearly all of my observations. Were did it went wrong ?

I would be very grateful for any advise or tips.

My do-file for the regression model looks like this:

ssc install reghdfe

destring sic, replace
sort sic

gen industry1=1 if inrange(sic, 100, 192)
replace industry1=0 if !inrange(sic, 100, 192)

gen industry2=1 if inrange(sic, 200, 291)
replace industry2=0 if !inrange(sic, 200, 291)

gen industry3=1 if inrange(sic, 700, 783)
replace industry3=0 if !inrange(sic, 700, 783)

gen industry4=1 if inrange(sic, 2830, 2836)
replace industry4=0 if !inrange(sic, 2830, 2836)

gen industry5=1 if inrange(sic, 1000, 1099)
replace industry5=0 if !inrange(sic, 1000, 1099)

gen industry6=1 if inrange(sic, 1200, 1241)
replace industry6=0 if !inrange(sic, 1200, 1241)

gen industry7=1 if inrange(sic, 1300, 1389)
replace industry7=0 if !inrange(sic, 1300, 1389)

gen industry8=1 if inrange(sic, 1400, 1499)
replace industry8=0 if !inrange(sic, 1400, 1499)

gen industry9=1 if inrange(sic, 1500, 1542)
replace industry9=0 if !inrange(sic, 1520, 1542)

gen industry10=1 if inrange(sic, 1600, 1629)
replace industry10=0 if !inrange(sic, 1600, 1629)

gen industry11=1 if inrange(sic, 1700, 1799)
replace industry11=0 if !inrange(sic, 1700, 1799)

gen industry12=1 if inrange(sic, 2000, 2099)
replace industry12=0 if !inrange(sic, 2000, 2099)

gen industry13=1 if inrange(sic, 2100, 2141)
replace industry13=0 if !inrange(sic, 2100, 2141)

gen industry14=1 if inrange(sic, 2200, 2299)
replace industry14=0 if !inrange(sic, 2200, 2299)

gen industry15=1 if inrange(sic, 2300, 2399)
replace industry15=0 if !inrange(sic, 2300, 2399)

gen industry16=1 if inrange(sic, 2400, 2499)
replace industry16=0 if !inrange(sic, 2400, 2499)

gen industry17=1 if inrange(sic, 2500, 2599)
replace industry17=0 if !inrange(sic, 2500, 2599)

gen industry18=1 if inrange(sic, 2600, 2679)
replace industry18=0 if !inrange(sic, 2600, 2679)

gen industry19=1 if inrange(sic, 2700, 2796)
replace industry19=0 if !inrange(sic, 2700, 2796)

gen industry20=1 if inrange(sic, 2800, 2899)
replace industry20=0 if !inrange(sic, 2800, 2899)

gen industry21=1 if inrange(sic, 2900, 2999)
replace industry21=0 if !inrange(sic, 2900, 2999)

gen industry22=1 if inrange(sic, 3000, 3089)
replace industry22=0 if !inrange(sic, 3000, 3089)

gen industry23=1 if inrange(sic, 3100, 3199)
replace industry23=0 if !inrange(sic, 3100, 3199)

gen industry24=1 if inrange(sic, 3200, 3299)
replace industry24=0 if !inrange(sic, 3200, 3299)

gen industry25=1 if inrange(sic, 3300, 3399)
replace industry25=0 if !inrange(sic, 3300, 3399)

gen industry26=1 if inrange(sic, 3400, 3499)
replace industry26=0 if !inrange(sic, 3400, 3499)

gen industry27=1 if inrange(sic, 3500, 3599)
replace industry27=0 if !inrange(sic, 3500, 3599)

gen industry28=1 if inrange(sic, 3600, 3699)
replace industry28=0 if !inrange(sic, 3600, 3699)

gen industry29=1 if inrange(sic, 3700, 3799)
replace industry29=0 if !inrange(sic, 3700, 3799)

gen industry30=1 if inrange(sic, 3800, 3873)
replace industry30=1 if !inrange(sic, 3800, 3873)

gen industry31=1 if inrange(sic, 3900, 3999)
replace industry31=0 if !inrange(sic, 3900, 3999)

gen industry32=1 if inrange(sic, 4000, 4013)
replace industry32=0 if !inrange(sic, 4000, 4013)

gen industry33=1 if inrange(sic, 4100, 4173)
replace industry33=0 if !inrange(sic, 4100, 4173)

gen industry34=1 if inrange(sic, 4200, 4231)
replace industry34=0 if !inrange(sic, 4200, 4231)

gen industry35=1 if inrange(sic, 4400, 4499)
replace industry35=0 if !inrange(sic, 4400, 4499)

gen industry36=1 if inrange(sic, 4500, 4583)
replace industry36=0 if !inrange(sic, 4500, 4583)

gen industry37=1 if inrange(sic, 4600, 4619)
replace industry37=0 if !inrange(sic, 4600, 4619)

gen industry38=1 if inrange(sic, 4700, 4789)
replace industry38=0 if !inrange(sic, 4700, 4789)

gen industry39=1 if inrange(sic, 4800, 4899)
replace industry39=0 if !inrange(sic, 4800, 4899)

gen industry40=1 if inrange(sic, 5000, 5099)
replace industry40=0 if !inrange(sic, 5000, 5099)

gen industry41=1 if inrange(sic, 5100, 5199)
replace industry41=0 if !inrange(sic, 5100, 5199)

gen industry42=1 if inrange(sic, 5200, 5271)
replace industry42=0 if !inrange(sic, 5200, 5271)

gen industry43=1 if inrange(sic, 5300, 5399)
replace industry43=0 if !inrange(sic, 5300, 5399)

gen industry44=1 if inrange(sic, 5400, 5499)
replace industry44=0 if !inrange(sic, 5400, 5499)

gen industry45=1 if inrange(sic, 5500, 5599)
replace industry45=0 if !inrange(sic, 5500, 5599)

gen industry46=1 if inrange(sic, 5500, 5599)
replace industry46=0 if !inrange(sic, 5500, 5599)

gen industry47=1 if inrange(sic, 5600, 5699)
replace industry47=0 if !inrange(sic, 5600, 5699)

gen industry48=1 if inrange(sic, 5700, 5736)
replace industry48=0 if !inrange(sic, 5700, 5736)

gen industry49=1 if inrange(sic, 5800, 5813)
replace industry49=0 if !inrange(sic, 5800, 5813)

gen industry50=1 if inrange(sic, 5900, 5999)
replace industry50=0 if !inrange(sic, 5900, 5999)

gen industry51=1 if inrange(sic, 7000, 7041)
replace industry51=0 if !inrange(sic, 7000, 7041)

gen industry52=1 if inrange(sic, 7200, 7299)
replace industry52=0 if !inrange(sic, 7200, 7299)

gen industry53=1 if inrange(sic, 7300, 7389)
replace industry53=0 if !inrange(sic, 7300, 7389)

gen industry54=1 if inrange(sic, 7500, 7549)
replace industry54=0 if !inrange(sic, 7500, 7549)

gen industry55=1 if inrange(sic, 7800, 7841)
replace industry55=0 if !inrange(sic, 7800, 7841)

gen industry56=1 if inrange(sic, 7900, 7999)
replace industry56=0 if !inrange(sic, 7900, 7999)

gen industry57=1 if inrange(sic, 8000, 8099)
replace industry57=0 if !inrange(sic, 8000, 8099)

gen industry58=1 if inrange(sic, 8100, 8111)
replace industry58=0 if !inrange(sic, 8100, 8111)

gen industry59=1 if inrange(sic, 8200, 8299)
replace industry59=0 if !inrange(sic, 8200, 8299)

gen industry60=1 if inrange(sic, 8300, 8399)
replace industry60=0 if !inrange(sic, 8300, 8399)

gen industry61=1 if inrange(sic, 8700, 8748)
replace industry61=0 if inrange(sic, 8700, 8748)

gen industry62=1 if inrange(sic, 9900, 9999)
replace industry62=0 if !inrange(sic, 9900, 9999)

run cluster2.ado

eststo model1: cluster2 CashtoAt TXUNCER fiveyearRTC fiveyearCASHETR fcons nol lossfirm NWC lev EBITDA MTBR size divpo capEx aquist atCF resDev, fcluster(gvkey) tcluster(fyear)

esttab model1 using table6.html, replace

eststo multinationals: cluster2 CashtoAt TXUNCER fiveyearRTC fiveyearCASHETR fcons nol lossfirm NWC lev EBITDA MTBR size divpo capEx aquist atCF resDev if mne==1, fcluster(gvkey) tcluster(fyear)

eststo domestics: cluster2 CashtoAt TXUNCER fiveyearCASHETR fcons nol lossfirm NWC lev EBITDA MTBR size divpo capEx aquist atCF resDev if mne==0, fcluster(gvkey) tcluster(fyear)

esttab model1 multinationals domestics using table6.html, noconstant replace label ///
mtitle("Full Sample" "Multinationals" "Domestics") nonumbers ///
title(Table 6) ar(2) compress nonotes