Dear Statalist,
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.
The output is
Clearly, It can not recognize "1.length" and didn't add the row I I want. However if I change the label of 1.length to a single word "Less_than_150" (If space is included, it will not work again), and use the label inside refcat, it does work. The problem is, I cannot label all my category variables with a single word.
And the output is
Is it a bug with tabstat or refcat? What should I do with my long value labels?
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 ---------------------------------------------------
Comment