0

When using Stata's strate command, is it possible to export its output to a LaTeX table?

In a similar vein as, for instance, the community-contributed estout family of commands can do.

4

1 回答 1

1

你想要的可以通过使用命令的output()选项strateesttab.

考虑以下玩具示例:

webuse diet, clear
stset dox, origin(time doe) id(id) scale(365.25) fail(fail==1 3 13)

stsplit ageband, at(40(10)70) after(time=dob) trim

preserve
tempfile myfile
strate ageband, per(1000) output(`myfile')
use `myfile', clear
mkmat *, matrix(A)
restore

esttab matrix(A), title("Summary results") ///
                  mlabels(, none) ///
                  varlabels(r1 " " r2 " " r3 " ")                                                                   

Summary results
------------------------------------------------------------------------------------------
                  ageband           _D           _Y        _Rate       _Lower       _Upper
------------------------------------------------------------------------------------------
                       40            6     .9070062      6.61517     2.971936     14.72457
                       50           18     2.107042     8.542783     5.382317     13.55906
                       60           22     1.493292     14.73255     9.700656     22.37457
------------------------------------------------------------------------------------------

tex选项esttab将产生所需的LaTeX输出:

esttab matrix(A), title("Summary results") ///
                  mlabels(, none) ///
                  varlabels(r1 " " r2 " " r3 " ") ///
                  tex

\begin{table}[htbp]\centering
\caption{Summary results}
\begin{tabular}{l*{6}{c}}
\hline\hline
            &     ageband&          \_D&          \_Y&       \_Rate&      \_Lower&      \_Upper\\
\hline
            &          40&           6&    .9070062&     6.61517&    2.971936&    14.72457\\
            &          50&          18&    2.107042&    8.542783&    5.382317&    13.55906\\
            &          60&          22&    1.493292&    14.73255&    9.700656&    22.37457\\
\hline\hline
\end{tabular}
\end{table}
于 2019-06-24T20:53:07.727 回答