Dear all,
I am having trouble with some debugging. I created a program to run some regressions using reghdfe and ivreghdfe, please see below a simplified version of it.
I then run the following loop to execute the regressions:
However, I get the following error:
invalid 'absorb'.
What am I not seeing?
Thanks in advance
I am having trouble with some debugging. I created a program to run some regressions using reghdfe and ivreghdfe, please see below a simplified version of it.
Code:
capture program drop reg_prog
program reg_prog
syntax varlist( max=1) [if] [, absorb(varlist) filename(string) controls(namelist) het_var(namelist) ]
preserve
if `"`if'"' != "" {
keep `if'
}
di `interaction'
global outcome `1'
global fixed_effects `absorb'
global controls_reg `controls'
eststo clear
estimates clear
qui reghdfe $outcome c.treatment##c.`het_var', a($fixed_effects) vce(cl facility_cod)
qui sum `e(depvar)' if e(sample)
qui estadd scalar control_mean= r(mean)
qui estadd scalar control_std= r(sd)
add_scalars_hiv
qui estimates store model1, title("OLS")
restore
end
Code:
local names " "name1" "name2" "name3" "name4" "
local i = 1
foreach var in var1 var2 cvar dvar {
global outcome `var'
local q: word `i' of `names'
dis `i' " - " "`q'"
reg_prog $outcome, controls($controls) absorb(abs1 abs2) filename("tables/tab_`q'_interaction.tex") het_var(hetvar)
local ++i
}
invalid 'absorb'.
What am I not seeing?
Thanks in advance
Comment