Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: stata estimates to latex table in vertical

From   Mauricio Andrés Vela <>
Subject   st: stata estimates to latex table in vertical
Date   Thu, 23 May 2013 16:50:57 -0400

Suppose I am interested in only one coefficient from different
regression methods but always with the same dependent variable. Is
there a way to create a latex table where each of the coefficient
(with standard error and stars below) from the different estimations
is included in a different row of the column. In this case it would
have only one columns and n different rows. Maybe if it is possible,
add other columns for a different dependent variable with the same n

It would be something as using parmby but where the standard errors
are included below the coefficient and where it could be possible of
joining other columns.

I have done this but in this case each row only changes the indicator
of my interest independent variable. Also I had to include the
standard error in another column and not below the coefficient. There
should be a faster way to do this. In this case below there are two
dependent variables mate and leng.

tex \begin{table}[H]\caption{Effect for different PM10 measures}
tex \begin{center}
tex \begin{tabular}{|>{\raggedright}p{5cm}|p{2cm}p{3cm}|
tex & \multicolumn{2}{c|}{Mate}  & \multicolumn{2}{c}{Leng}  \\
tex   PM10 Variable & Coefficient & Std. Error  &  Coefficient & Std.
Error  \\ \hline
foreach y in mate leng {
use base, clear

global tflist ""
foreach x of varlist pwdays50 pwdays120 pwdays150 pdays50 pdays120
pdays150 pwinterwdays50 pwinterwdays120 pwinterwdays150 ///
 percentil98 pma_week150 pweek_120 p98week_120 pweek_150 p98week_150
pmonth_120 p98month_120 pmonth_150 p98month_150 {
tempfile tfcur
parmby "xi: xtreg `y' `x' i.year, fe vce(cluster rbd)", lab
saving(`"`tfcur'"', replace) flist(tflist) ///
format(estimate %8.2f stderr %8.3f ) list(label estimate stars)
stars(0.1 0.05 0.01 ) ids(`x')
drop _all
append using $tflist
duplicates drop ids, force
drop parmseq parm dof t p min95 max95
foreach x of varlist estimate stderr stars {
rename `x' `x'_`y'
tempfile `y'
save ``y''
use `mate', clear
mmerge label using `leng'

sort idstr
drop  _merge idstr
foreach x of numlist 1/`=_N' {
local label=label[`x']
foreach y of varlist estimate_mate-stars_leng {
local `y': di %4.2f `y'[`x']
tex   `label' & `estimate_mate' & (`stderr_mate')`stars_mate' &
`estimate_leng' & (`stderr_leng')`stars_leng' \\ \hline

tex \hline
tex \end{tabular}
tex \end{center}
tex \end{table}
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index