Announcement

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

  • Labels in by group variable using estpost tabstat

    Hi everyone,

    I am trying to export a descriptive statistics table using estpost tabstat and esttab but I keep getting numeric values when using the by(group) option even though the variable group is a string. I am using this code:

    eststo av: estpost tabstat A B C D E F G, ///
    statistics(mean median sd max min n) by(region) columns(statistics)

    esttab av using "${path}/statistics.tex", label noobs booktabs nonumber nodepvars nomtitles ///
    cells("Mean(pattern(1 1 0) fmt(2)) p50(fmt(0)) SD(pattern(1 1 0)) Min(fmt(0)) Max(fmt(0)) count(fmt(0))") ///
    collabels("Mean" "Median" "Std. Dev." "Min." "Max." "N") replace

    And I get:

    Region | e(Mean) e(p50) e(SD) e(Max) e(Min) e(count)
    -------------+------------------------------------------------------------------
    1 |
    A | 3.5 3 .9718253 5 2 10
    B | .6 1 .5163978 1 0 10
    C | .8 1 .421637 1 0 10
    D | .1 0 .3162278 1 0 10
    E | 0 0 0 0 0 10
    F | 0 0 0 0 0 10
    G | 0 0 0 0 0 10
    -------------+------------------------------------------------------------------
    2 |
    A | 2.833333 3 .3892495 3 2 12
    B | .9166667 1 .2886751 1 0 12
    C | 1 1 0 1 1 12
    .
    .
    .


    I want in the table the values of the region variable (Europe, Asia, Africa, America...) instead of numbers (1, 2, 3, 4...).

    Many thanks,

    Tessa

  • #2
    estout is from SSC, as you are asked to explain (FAQ Advice #12). This may be due to long labels. Show the exact Stata output and post this within code delimiters.

    Comment

    Working...
    X