Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to create a table with dummay as columns and variables as rows (with formatting)

    Hi all,

    I recently run into this issue of organizing my summary statistics into a table but distinguishing the dummy variable. per se my dummy takes value of 1 if true and 0 otherwise. I have several variables which I want to look at the average and robust standard error for. And I want to organize my table into this:
    dummy=1 dummy=0
    Var 1 mean(Var1) if dummy==1, (RSE) mean(Var1) if dummy==0, (RSE)
    Var 2 mean(Var2) if dummy==1, (RSE) mean(Var2) if dummy==0, (RSE)
    There are of course more than one variable, but I'm confused with how to organize my table into this, especially that Var1, Var2,..., dummy are all variables. I also hope to export this table into a latex form which is why I was trying to use "estout" and "esttab" commands but just couldn't get it into this form.

    Thanks in advance!

  • #2
    Code:
    sysuse auto, clear
    table () (foreign) ,        ///
        stat(mean mpg price)    ///
        stat(semean mpg price)  ///
        nototal nformat(%9.3g)  ///
        sformat("(%s)" semean)
        
    collect layout (var#result) (foreign)
    After that you can use collect export to save that as a LaTeX table
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment

    Working...
    X