Dear community/Jeff Pitblado (StataCorp)
I'm having problems with displaying the mean of a variable when building a table with dtable. After many tries I still get nowhere and dtable only add the number of observations to the table. Is there a way to solve this? (Stata 18.0)
Here is my code:
The resulting table:
Eptinezumab dose first infusion
N (N=39)
I want the mean (100) and not the N=39.
I'm having problems with displaying the mean of a variable when building a table with dtable. After many tries I still get nowhere and dtable only add the number of observations to the table. Is there a way to solve this? (Stata 18.0)
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int doseepti1 byte(epagat2c09 epagacec09 epagcabln0) 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 1 .a .a 100 .a .a .a 100 1 .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 1 .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a 100 .a .a .a end
Code:
collect clear dtable 1.epagbeta1c 1.epagbeta2c 1.epagbeta3c, /// factor(, statistic(fvfrequency fvpercent)) /// sample("N", statistic(frequency) place(seplabels)) /// sformat("(N=%s)" frequency) /// nformat(%6.1f mean sd) name(del1) dtable doseepti1, name(del2) collect combine all = del1 del2 collect label levels collection del1 "Current preventives at baseline" collect label levels collection del2 "Eptinezumab dose first infusion" collect style header epagbeta1c epagbeta2c epagbeta3c, level(hide) collect layout (del2) (result[mean sd]) collect layout (collection#var) (result)
Eptinezumab dose first infusion
N (N=39)
I want the mean (100) and not the N=39.
Comment