Hi all—I am a Stata 17 user on several operating systems. I have run into some version of this problem a few times trying to create basic tables of summary statistics comparing values across different by() groups.

I have no problem creating a table comparing means and SDs for multiple variables across different by groups that looks very nice, but can only do so in a vertically oriented way:

Code:
clear all
sysuse auto 

*Table I want transposed

estpost tabstat price mpg weight, ///
  by(foreign) stats(mean sd) listwise nototal c(stats)

esttab, main(mean) aux(sd) nostar nogaps ///
  noobs nomtitle nonumber label unstack /// 
  note("Standard deviations in parentheses")

Which produces (sorry in advance that this isn't rendering in an attractive way) :

----------------------------------------------
Domestic Foreign
----------------------------------------------
Price 6072.4 6384.7
(3097.1) (2621.9)
Mileage (mpg) 19.83 24.77
(4.743) (6.611)
Weight (lbs.) 3317.1 2315.9
(695.4) (433.0)
----------------------------------------------
Standard deviations in parentheses


I would like a transposed version of this, with the rows being the by-groups and the columns being the variables, with the same structure of mean (sd) preserved. Yet when I try the direct modification (using c(variables) instead of c(stats) in the estpost command), I get no table at all:

Code:
est clear
*My attempt at using c(variables) does not work: 
estpost tabstat price mpg weight, ///
  by(foreign) stats(mean sd) listwise nototal c(variables)

esttab, main(mean) aux(sd) nostar nogaps ///
  noobs nomtitle nonumber label unstack /// 
  note("Standard deviations in parentheses")
This produces just 3 horizontal lines with no data at all.

Thank you in advance for the help!