Announcement

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

  • How do I export tabstat results to Latex?

    Code:
    webuse auto, clear
    tabstat price trunk weight, stat(mean) by(make) format(%9.0fc)
    estimate store summary
    esttab summary using "summarystats1.tex", replace cells("price trunk weight") nonumb noobs
    I need to export in Latex format with car makers in string name and format(%9.0fc), that is, zero decial and comma every thousand.

    May I ask how I can do this?
    I really appreciate any help you can provide.

  • #2
    Like this.

    Comment


    • #3
      Originally posted by Jared Greathouse View Post
      I need to divide "mean' by "makers (make)"

      Your solution did not work.

      Comment


      • #4
        Okay, so then show me what Stata gave you. I ain't at my computer now, so I can't test it myself, but let's at least see what Stata did collect so we can see what might work, then.

        Comment


        • #5
          Method 1, close to your original method:
          Code:
          webuse auto, clear
          estpost tabstat price trunk weight, stat(mean) by(make) elabels
          estimate store summary
          esttab summary, ///
              cells("price(fmt(%9.0fc)) trunk(fmt(%9.0fc)) weight(fmt(%9.0fc))") unstack ///
              varlabels(`e(labels)') nonumb noobs
          The keys here are using estpost to store the estimates from esttab, and using the elabels option to save the car make labels. The formatting is handled by esttab, not by tabstat.

          Method 2, what I would do:
          Code:
          webuse auto, clear
          eststo price  : estpost tabstat price,  stat(mean) by(make) elabels
          eststo trunk  : estpost tabstat trunk,  stat(mean) by(make) elabels
          eststo weight : estpost tabstat weight, stat(mean) by(make) elabels
          esttab price trunk weight, ///
              main(mean %9.0fc) not ///
              varlabels(`e(labels)') nonumb noobs nostar ///
              mtitles
          I try to avoid using cells() with esttab when I can. Here I conceptualize the table as three models rather than one model, which makes each model simpler, and allows us to use more standard esttab options.

          Comment

          Working...
          X