Statalist


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

Re: st: esttab models in rows tex output


From   Ben Jann <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: esttab models in rows tex output
Date   Sun, 8 Feb 2009 21:06:03 +0100

You probably ran the code twice so that results from the first run
were picked up in the second run. Add -eststo clear- at the top of the
code to make it save, i.e. type

eststo clear
sysuse auto
eststo model1: quietly reg price weight
...

ben

On Tue, Feb 3, 2009 at 4:12 PM, Nelson, Carl <chnelson@illinois.edu> wrote:
> 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/
>

*
*   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