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

st: esttab models in rows tex output

From   "Nelson, Carl" <>
To   "" <>
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)                                   ///

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.

Carl Nelson

*   For searches and help try:

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