Announcement

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

  • Export tabstat table into Latex

    Good morning,

    This is probably a classic question but I really have not found a good answer to it. I would like to know a general method to export into LaTex a table of descriptive statistics generated by tabstat. I have tried solutions offered by eststo/esttab but they do not generate the table that I need. In particular, I need a table exactly as the example below shows:

    Code:
    sysuse auto.dta,clear
    
    tabstat trunk weight length, statistics(N mean sd min max) columns(statistics)
    
        Variable |         N      Mean        SD       Min       Max
    -------------+--------------------------------------------------
           trunk |        74  13.75676  4.277404         5        23
          weight |        74  3019.459  777.1936      1760      4840
          length |        74  187.9324  22.26634       142       233
    ----------------------------------------------------------------
    As always, thank you very much.
    Cheers,
    Rubén

  • #2
    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . foreach var of varlist trunk weight length {
      2.     foreach stat in mean sd min max {
      3.         local stats "`stats' stat(`stat' `var')"
      4.     }
      5. }
    
    .
    . table (var) (result), `stats'
    
    --------------------------------------------------------------------------------------
                          |      Mean   Standard deviation   Minimum value   Maximum value
    ----------------------+---------------------------------------------------------------
    Trunk space (cu. ft.) |  13.75676             4.277404               5              23
    Weight (lbs.)         |  3019.459             777.1936            1760            4840
    Length (in.)          |  187.9324             22.26634             142             233
    --------------------------------------------------------------------------------------
    After that you can use collect export to export it to LaTex
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Dear Maarten,

      Thank you very much!

      Best,
      Rubén

      Comment

      Working...
      X