Dear All
I am trying to obtain a table including descriptive statistics using the esttab package.
I've been using the estpost / esttab command for categorical variables with proportions. I want the baseline characteristics (sex, ethnicity, season) as proportions according to quartiles of vitamin E (vitq) (like link: Table 2):
My syntax:
qui estpost svy,subpop(if eligible==1): tabulate sex vitq, column percent
qui eststo A
qui estpost svy,subpop(if eligible==1): tabulate ethnicity vitq, column percent
qui eststo B
qui estpost svy,subpop(if eligible==1): tabulate season vitq, column percent
qui eststo C
#delimit;
esttab A B C using table1.txt, label nostar not unstack nonumbers mtitle("Vit quartiles") cells("b(fmt(1))") replace;
I’m using the unstack option to have the Vitamin quartiles on top building 4 rows (like in attached link >£100 etc.), so I get the proportions for each variable according to the vitamin group. The problem is, that the unstack option doesn’t allow me to put the results of sex, ethnicity and season one below the other, but instead places the results in separate columns. Without the unstack option, the vitamin quartiles are placed one below the other building cells instead of rows. Any suggestion?
I haven't been able to do the same for continuous variables with means +- SD (e.g. age). The svy: tabulate command works with categorical variables, is there a svy option for continuous variables (estpost sum/estpost tabstat don’t work with svy)?
Many thanks for your help
Einat
I am trying to obtain a table including descriptive statistics using the esttab package.
I've been using the estpost / esttab command for categorical variables with proportions. I want the baseline characteristics (sex, ethnicity, season) as proportions according to quartiles of vitamin E (vitq) (like link: Table 2):
My syntax:
qui estpost svy,subpop(if eligible==1): tabulate sex vitq, column percent
qui eststo A
qui estpost svy,subpop(if eligible==1): tabulate ethnicity vitq, column percent
qui eststo B
qui estpost svy,subpop(if eligible==1): tabulate season vitq, column percent
qui eststo C
#delimit;
esttab A B C using table1.txt, label nostar not unstack nonumbers mtitle("Vit quartiles") cells("b(fmt(1))") replace;
I’m using the unstack option to have the Vitamin quartiles on top building 4 rows (like in attached link >£100 etc.), so I get the proportions for each variable according to the vitamin group. The problem is, that the unstack option doesn’t allow me to put the results of sex, ethnicity and season one below the other, but instead places the results in separate columns. Without the unstack option, the vitamin quartiles are placed one below the other building cells instead of rows. Any suggestion?
I haven't been able to do the same for continuous variables with means +- SD (e.g. age). The svy: tabulate command works with categorical variables, is there a svy option for continuous variables (estpost sum/estpost tabstat don’t work with svy)?
Many thanks for your help
Einat
Comment