Announcement

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

  • esttab: mtitles above numbers & coef title

    Hello Statalisters,

    I used the pasted code to create Table 1 in LaTex, but I would like it to look like Table 2.

    Code:
      sysuse auto, clear
    
      local outcomes headroom trunk
      
      local j=1
      foreach outcome in `outcomes'{
        reg `outcome' mpg weight
        eststo mod`j'
        local j=`j'+1
      }
      
      esttab mod1 mod2 using "~/Desktop/filename.tex", replace title("Title")
    Click image for larger version

Name:	Screenshot 2023-11-09 at 6.46.55 PM.png
Views:	1
Size:	79.9 KB
ID:	1733407


    Any suggestions on how to (1) put the titles above the column numbers and (2) add a column title for the independent variables ([COEFTITLE]) would be very much appreciated! Thanks!

  • #2
    estout is from SSC, as you are asked to explain in FAQ Advice #12. Here is one way:

    Code:
    sysuse auto, clear
    local outcomes headroom trunk
    local j=1
    foreach outcome in `outcomes'{
        reg `outcome' mpg weight
        eststo mod`j'
        local j=`j'+1
    }
     esttab mod*, replace nonumb mlab((1) (2)) mgroups(headroom trunk, pattern(1 1) lhs(Variables)) 
    Res.:

    Code:
    .  esttab mod*, replace nonumb mlab((1) (2)) mgroups(headroom trunk, pattern(1 1) lhs(Variables))
    
    --------------------------------------------
    Variables        headroom           trunk   
                          (1)             (2)   
    --------------------------------------------
    mpg              -0.00989         -0.0827   
                      (-0.38)         (-0.75)   
    
    weight           0.000467*        0.00320***
                       (2.44)          (3.92)   
    
    _cons               1.794           5.849   
                       (1.67)          (1.28)   
    --------------------------------------------
    N                      74              74   
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      Worked perfectly, thank you!

      Comment

      Working...
      X