I'n trying to generate a publication-ready table (LaTeX) of summary statistics over values of a stratification variable. I want the stratification variable splayed across the columns of the table, and the variables I'm summarizing split across rows of the table. The variables I want to summarize include continuous and factor variables. For the continuous variables I want to characterize the mean and standard devaiation, but for the factor variables, I just want the percentages.
So far, all I've managed to make is something like this:
But what I'm trying to arrive at should look something like this:
I'd also like to sensibly format the values in the table, so there aren't excessive decimal places/significant figures displayed.
Any suggestions how to proceed?
So far, all I've managed to make is something like this:
Code:
. sysuse auto
(1978 automobile data)
. table (var result) (foreign) , stat(mean price mpg trunk) stat(sd price mpg trunk) stat(fvpercent rep78) stat(count rep78)
---------------------------------------------------------------
| Car origin
| Domestic Foreign Total
------------------------------+--------------------------------
Price |
Mean | 6072.423 6384.682 6165.257
Standard deviation | 3097.104 2621.915 2949.496
Mileage (mpg) |
Mean | 19.82692 24.77273 21.2973
Standard deviation | 4.743297 6.611187 5.785503
Trunk space (cu. ft.) |
Mean | 14.75 11.40909 13.75676
Standard deviation | 4.306288 3.216906 4.277404
Repair record 1978=1 |
Factor variable percent | 4.17 0.00 2.90
Repair record 1978=2 |
Factor variable percent | 16.67 0.00 11.59
Repair record 1978=3 |
Factor variable percent | 56.25 14.29 43.48
Repair record 1978=4 |
Factor variable percent | 18.75 42.86 26.09
Repair record 1978=5 |
Factor variable percent | 4.17 42.86 15.94
Repair record 1978 |
Number of nonmissing values | 48 21 69
---------------------------------------------------------------
Code:
-----------------------------------------------------------
| Car origin
| Domestic Foreign Total
--------------------------+--------------------------------
Price |
Mean | 6072.423 6384.682 6165.257
Standard deviation | 3097.104 2621.915 2949.496
Mileage (mpg) |
Mean | 19.82692 24.77273 21.2973
Standard deviation | 4.743297 6.611187 5.785503
Trunk space (cu. ft.) |
Mean | 14.75 11.40909 13.75676
Standard deviation | 4.306288 3.216906 4.277404
Repair record 1978 |
% 1 | 4.17 0.00 2.90
% 2 | 16.67 0.00 11.59
% 3 | 56.25 14.29 43.48
% 4 | 18.75 42.86 26.09
% 5 | 4.17 42.86 15.94
N | 48 21 69
-----------------------------------------------------------
Any suggestions how to proceed?

Comment