How can I get outreg results in separate tables on the same document while I have the outreg in a loop.
I provided the answer I found below.
Need to install outreg from http://fmwww.bc.edu/RePEc/bocode/o
'OUTREG': module to write estimation tables to a Word or TeX file
(note that you need to uninstall any previous updates of outreg if found)
The documentation of the above is found here. It provides examples on the following:
addtableMerging multiple estimation results in a loop in which you loop over outreg without outputting the results then replay over the outreg results saved in memory to output the table. Example:
outreg, clear
forvalues r = 2/5 {
quietly reg mpg price weight if rep78==`r'
outreg, merge varlabels ctitle("", "`r'") nodisplay
}
outreg using auto, replay replace title(Regressions by Repair Record)
Merging the estimation results in a loop into two separate outreg tables: declare different tables to save in at first, then use addtable after the loops to output two seperate tables into word. Example:
outreg, clear(iv)
outreg, clear(first)
forvalues r = 1/4 {
quietly ivreg2 rent pcturban (hsngval = faminc) if reg`r', savefirst
outreg, merge(iv) varlabels ctitle("","Region `r'") nodisplay
quietly estimates restore _ivreg2_hsngval
outreg, merge(first) varlabels ctitle("","Region `r'") nodisplay
}
outreg using iv, replay(first) replace title(First Stage Regressions)
outreg using iv, replay(iv) addtable title(Variables Regression)