Statalist


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

st: esttab models in rows tex output


From   "Nelson, Carl" <chnelson@illinois.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: esttab models in rows tex output
Date   Tue, 3 Feb 2009 09:12:56 -0600

Following Ben Jann's extremely helpful answer to my previous question about placing models in rows in esttab output I tried to take the next step of generating tex output. The stata source, using Ben's template do file, for the attempt is:

sysuse auto
eststo model1: quietly reg price weight
eststo model2: quietly reg price weight mpg
esttab, se nostar
matrix C = r(coefs)
eststo clear
local rnames : rownames C
local models : coleq C
local models : list uniq models
local i 0
foreach name of local rnames {
    local ++i
    local j 0
    capture matrix drop b
    capture matrix drop se
    foreach model of local models {
        local ++j
        matrix tmp = C[`i', 2*`j'-1]
        if tmp[1,1]<. {
            matrix colnames tmp = `model'
            matrix b = nullmat(b), tmp
            matrix tmp[1,1] = C[`i', 2*`j']
            matrix se = nullmat(se), tmp
        }
    }
    ereturn post b
    quietly estadd matrix se
    eststo `name'
}
esttab using example.tex, nodepvars compress replace    ///
     label booktabs nonumber                         ///
     page(dcolumn)                                   ///
     alignment(D{.}{.}{-1})

I can't paste the pdf output into this email so let me try to describe it. The rows are weight mpg model1 model2 and constant. The columns are model1 model2 weight mpg _cons. Thus the two models are presented in the first two columns and in the third and fourth row. The LaTeX source can be easily edited to obtain the desired table. But i am writing to ask if there is any way to supress the unwanted rows and columns in the esttab tex output.
Thanks.

Carl Nelson

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index