I would like to make a table along multiple column variables (e.g. gender and wave / foreign and somecategory). I would also like to have a categorical variable "header" for cohort / Repair Record 1978, which is the variable label.

does this. However, it seems that dtable only allows for one column variable (I cannot add 'somecategory'). Is this true?
An option using -table- is
But this keeps mean and sd on separate rows. I cannot get sd next to the means in a compact manner, as in -dtable-. Additionally, this option does not add the header "Repair Record 1978" that groups all values of the categorical variable rep78, as in -dtable- above.
HTML Code:
sysuse auto, clear generate u1 = runiform() sort u1 gen somecategory = (_n<30) dtable mpg i.rep78, by(foreign)
does this. However, it seems that dtable only allows for one column variable (I cannot add 'somecategory'). Is this true?
An option using -table- is
HTML Code:
table (var) (foreign somecategory) , stat(mean mpg i.rep78) stat(sd mpg) nototals

Comment