I am using a foreach loop incombination with the estout package in Stata to automatically report a lot of regressions. The reporting works nicely with one exception. When using
with two independent variables, the variable labels do not get printed in the title because j is assigned to two independent variables and estout returns the following message "race not allowed" and "never_married not allowed". Is there a way to include both variable labels in the title? I tried subsetting the j variable using `j[1]' but it only returns the error "nothing found where name expected".
Stata Version: 8
OS: Windows 10
Code:
`var lab `j'
Code:
webuse nlsw88.dta, clear local dvs wage hours local alls `aiv' `biv' local c 0 foreach i of local dvs { local c = `c' + 1 local f = 0 foreach j in "age race" "married never_married" { local f = `f' + 1 eststo model`c'`f': reg `i' `j' esttab model`c'`f' using Regressionloops.rtf, append se label onecell nomtitles nogaps title(\page "Title DV = `: var lab `i'' & IV = `: var lab `j''") } eststo drop * }
OS: Windows 10
Comment