I have used the following code to export summary statistics to excel:
table1, by(wage8) vars(age contn\race cat\ married cat \ never_married cat\grade contn\collgrad cat\south cat \smsa cat\ c_city cat\industry cat\occupation cat\union cate\hours contn\ttl_exp contn) test onecol format(%2.1f) main(mean) aux(sd) saving(wage8.xls, replace)
How can I modify the code to dispay mean and sd( for continous variables) or % ( for categorical variables) in different rows instead of one cell
This is the current display of output. The mean and sd are displayed in one cell
table1, by(wage8) vars(age contn\race cat\ married cat \ never_married cat\grade contn\collgrad cat\south cat \smsa cat\ c_city cat\industry cat\occupation cat\union cate\hours contn\ttl_exp contn) test onecol format(%2.1f) main(mean) aux(sd) saving(wage8.xls, replace)
How can I modify the code to dispay mean and sd( for continous variables) or % ( for categorical variables) in different rows instead of one cell
This is the current display of output. The mean and sd are displayed in one cell
Factor | Less than $8 | Greater than or equal to $8 | p-value | Test |
N | 1467 | 779 | ||
Age in current year, mean (SD) | 39.1 (3.1) | 39.2 (3.0) | 0.81 | Two sample t test |
Race | <0.001 | Pearson's chi-squared | ||
White | 1034 (70.5%) | 603 (77.4%) | ||
Black | 418 (28.5%) | 165 (21.2%) | ||
Other | 15 (1.0%) | 11 (1.4%) | ||
Married | 0.26 | Pearson's chi-squared | ||
Single | 513 (35.0%) | 291 (37.4%) | ||
Married | 954 (65.0%) | 488 (62.6%) | ||
Never married | 0.010 | Pearson's chi-squared | ||
Has been married | 1332 (90.8%) | 680 (87.3%) | ||
Never married | 135 (9.2%) | 99 (12.7%) |