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
Related Posts with Labels in by group variable using estpost tabstat
Extracting the year from a variable in stataHello, I probably have a very simple query but I can't work out how to solve it I have a variable en…
Loop over quarterly variables to find yearly meansHi Everyone, I'm quite new to Stata (version 17.0) and I'm having some trouble implementing a loop …
save psmatch2 outputHello All, This should be a very easy question, but I am unable to figure out how to save the outpu…
Create a chart to track changes of exectuive titlesHi Statalist, I want to create a chart to record the title changes of exectuives. For example, I w…
Summation using If condition to avoid negative valuesHello, I want to write a code that creates a value which is the summation of several rows. I have n…
Subscribe to:
Post Comments (Atom)
0 Response to Labels in by group variable using estpost tabstat
Post a Comment