How can I save the results of the following command in a matrix? and how can I export the table after following command to excel using putexcel command?
Code:
table group SurveyYear , content(mean median_CTDI mean median_DLP)
table group SurveyYear , content(mean median_CTDI mean median_DLP)
sysuse auto, clear * Create two categorical variables for the demo. gen str3 catvar1 = "Dom" replace catvar1 = "For" if foreign gen catvar2 = "Group1" replace catvar2 = "Group2" if rep78 >3 tabstat price mpg, stat(mean median) by(catvar1) save mat A1 = r(Stat1) mat A2 = r(Stat2) tabstat price mpg, stat(mean median) by(catvar2) save mat B1 = r(Stat1) mat B2 = r(Stat2) mat C = A1,A2\B1,B2 matlist C
table group SurveyYear
tabstat group SurveyYear
sysuse auto, clear tabstat price mpg, stat(mean median) save matrix list r(StatTotal)
Leave a comment: