Up until now I've used -outreg- for this. However this spring I tried,
and quickly adopted, -estout-. Both will do what you request, but
-estout- takes you straight into LaTeX without having to pass through
Word (or, in my view better, Excel since there is the Excel2latex
macro that is very handy).
you just put -est XYZ- after each regression (where XYZ is a unique
reference). The following is the -estout- code I used in one of my do
files after estimating 6 equations and naming them A-F. Note that I
use the bookends package to make my tables look better. It is true
that I have to put quite a lot of LaTeX code manually into the
do-file, but you do get very nice output. Also note that I have
defined \tenpc, \fivepc and \onepc in the preamble of my document (**,
* and dagger).
estout A B C D E F using ../textables/glogit_p.tex, ///
eform keep(lHHInc_Med pHHLatino pKids12t18 pHHLingIso p_EduLow
HasList MergeList) ///
style(tex) replace ///
stats(r2_a) stfmt(%9.2f) stlabels("Adjusted \$R^2\$") ///
starsym(\\tenpc \\fivepc \\onepc) star(0.10 0.05 0.01) detachstar ///
prehead( ///
\\begin{center} ///
\\begin{tabularx}{0.9\\textwidth}{lZ@{}lZ@{}lZ@{}lZ@{}lZ@{}lZ@{}l} \\\\ ///
\\toprule ///
& \\multicolumn{4}{c}{\\textbf{Kitchen Sink}} & ///
\\multicolumn{4}{c}{\\textbf{Parsimonius I}} & ///
\\multicolumn{4}{c}{\\textbf{Parsimonius II}} & ///
\\cmidrule(lr){2-5} \\cmidrule(lr){6-9} \\cmidrule(lr){10-13} ///
) ///
posthead(\\midrule) ///
prefoot(\\addlinespace ///
KSink Controls & Yes && Yes && && && && & \\ ///
State Dummies & && Yes && && Yes && && Yes &\\ ///
\\midrule) ///
postfoot(\\bottomrule ///
\\multicolumn{13}{l}{\\footnotesize{Legend: \$\\dag\$:
\$p<0.10\$,\hspace{1em} \$\\ast\$: ///
\$p<0.05\$, \hspace{1em} \$\\ast\\ast\$: \$p<0.01\$; \hspace{1em}
3094 Observations ///
\\normalsize}} ///
\\end{tabularx} ///
\\end{center}) ;
On Thu, 22 Jul 2004 09:23:30 -0400 (EDT), Stas Kolenikov
<[email protected]> wrote:
> > I want to produce a table in LaTeX that compares three to four
> > regression models, including regression coefficients, standard errors, R
> > square, etc. Is ther a way in Stata to automate this process? I know
> > that State has quite a few routines to help LaTeX users, I also
> > understand that in the single model case, one can simply use "outtex"
> > command. But it is not immediately clear how to generalize this to cases
> > that involve more than one models.
>
> If you've already mastered -outreg-, you might find it also relatively
> easy to:
>
> 1. -outreg- your estimation results;
>
> 2. open the resulting file in MS Word;
>
> 3. replace the tabs with & and the paragraph lines with \\, and here's
> what you need to do:
>
> 3a. press Ctrl-H (or go to Edit -> Replace); the string to "Find What" is
> "^t" (as is, "Shift-6" on my keyboard, and then "t". You can also find it
> under "More -> Special" part of the dialog as tabulation), and the string
> to "Replace With" is " & "; then click "Replace All"
>
> 3b. press Ctrl-H for the Find and Replace Dialog. The string to be
> replaced is "^p" (Shift-6 + p; also can be found in the special symbols as
> the paragraph mark), and the string to be replaced with is " \\^p" (so
> that it has both the LaTeX end of the table line, and then the regular
> carriage return symbol). Click "Replace All" again.
>
> 4. your stuff is ready. Of course you would need to provide the
> appropriate wraps like \begin{table} \caption{...\label{...}}
> \begin{tabular} and \end{tabular} \end{table} around the resulting body.
>
> --- Stas Kolenikov
> -- Ph.D. student in Statistics at UNC-Chapel Hill
> - http://www.komkon.org/~tacik/ -- [email protected]
>
> * This e-mail and all attachments to it are not intended to provide any
> * reasonable point of view and was transmitted to you in error. It
> * should be immediately deleted by all recipients unless they really
> * enjoy communicating with the author :). Other restrictions apply.
>
>
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/