I am using esttab and tabstat to produce descriptive statistics of 4 variables. I intend to add a row indicating the name of by-category, since I want to append different categories in the same table. I use refcat to tell esttab where to add a row, but it does not seem to work as I expected.
Code:
sysuse auto,clear
recode length (100/150=1 "Less than 150")(151/200=2 "150-200")(200/250=3 "more than 200"), ///
generate(length_cat)
eststo clear
eststo: estpost tabstat price weight mpg,by(length_cat)
esttab ,cells("price weight mpg") refcat(1.length "Length category",nolabel)
Code:
. esttab ,cells("price weight mpg") refcat(1.length "Length category",nolabel)
---------------------------------------------------
(1)
price weight mpg
---------------------------------------------------
Less tha~150 4261 1796.667 27.33333
150-200 5327.958 2677.708 23.3125
more tha~200 8161.043 3892.174 16.30435
Total 6165.257 3019.459 21.2973
---------------------------------------------------
N 74
---------------------------------------------------
Code:
recode length (100/150=1 "Less_than_150")(151/200=2 "150-200")(200/250=3 "more than 200"), ///
generate(length_cat2)
eststo clear
eststo: estpost tabstat price weight mpg,by(length_cat2)
esttab ,cells("price weight mpg") refcat("Less_than_150" "Length category",nolabel)
Code:
. esttab ,cells("price weight mpg") refcat("Less_than_150" "Length category",nolabel)
---------------------------------------------------
(1)
price weight mpg
---------------------------------------------------
Length cat~y
Less_tha~150 4261 1796.667 27.33333
150-200 5327.958 2677.708 23.3125
more tha~200 8161.043 3892.174 16.30435
Total 6165.257 3019.459 21.2973
---------------------------------------------------
N 74
---------------------------------------------------
0 Response to A seemingly bug with refcat (an option of estout), when using with tabstat ?
Post a Comment