Announcement

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

  • How to set supercolumns in table?

    Hello everyone!

    I am trying to make a table of this kind:

    Code:
    clear all
    sysuse auto
    
    table foreign var, statistic(mean price mpg) statistic(median price mpg)
    However, instead of the layout in which it is currently presented, I would like the variables price and mpg to form two distinct supercolumns, which are further divided into mean and median. How can I do that?

  • #2
    Code:
    clear all
    sysuse auto
    
    qui table foreign, statistic(mean price mpg) statistic(median price mpg)
    qui collect layout (foreign) (var#result)
    collect preview
    
    ---------------------------------------------------
               |        Price           Mileage (mpg)  
               |      Mean   Median       Mean   Median
    -----------+---------------------------------------
    Car origin |                                       
      Domestic |  6072.423   4782.5   19.82692       19
      Foreign  |  6384.682     5759   24.77273     24.5
      Total    |  6165.257   5006.5    21.2973       20
    ---------------------------------------------------

    Comment


    • #3
      That worked wonders, thank you!

      Comment

      Working...
      X