loops - How to outreg multiple tables on the same document in stata? -
how can outreg
results in separate tables on same document while have outreg in loop.
i provided answer found below.
need install outreg
http://fmwww.bc.edu/repec/bocode/o 'outreg': module write estimation tables word or tex file (note need uninstall previous updates of outreg if found)
the documentation of above found here. provides examples on following:
- placing additional tables in same document using
addtable
merging multiple estimation results in loop in loop on
outreg
without outputting resultsreplay
on outreg results saved in memory output 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 repair record)
merging estimation results in loop 2 separate outreg tables: declare different tables save in @ first, use
addtable
after loops output 2 seperate tables 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)
Comments
Post a Comment