I posted the following question on Stackoverflow, but have been unsuccesful in getting a solution:
http://stackoverflow.com/questions/2...-table-command
I have the following data and would like to produce some summary statistics in a three-way crosstabulation. Stata outputs the selected stats in rows, rather than in columns. I would also like to add further statistics like ttests and ranksum tests to each group. For regression output, I have been using eststo and esttab which works well. I haven't been successful in doing the same with statistics produced by the tabstat, tabulate, summarize or table commands.
table eventtime winner , contents(mean stakechange median stakechange n stakechange)
The following command give the same results, but in a different format:
I've been trying to use that to perform the tabstat on each group in a loop, as follows:
This is only outputting the result of the final estpost command, however. Is there another way I should be doing this?
http://stackoverflow.com/questions/2...-table-command
I have the following data and would like to produce some summary statistics in a three-way crosstabulation. Stata outputs the selected stats in rows, rather than in columns. I would also like to add further statistics like ttests and ranksum tests to each group. For regression output, I have been using eststo and esttab which works well. I haven't been successful in doing the same with statistics produced by the tabstat, tabulate, summarize or table commands.
Code:
clear input eventtime prefflag winner stakechange 1 1 1 10 1 2 1 5 2 1 0 50 2 2 0 31 2 1 1 51 2 2 1 20 1 1 0 10 2 2 1 10 2 1 0 5 1 2 0 8 end
The following command give the same results, but in a different format:
Code:
bysort eventtime winner: tabstat stakechange, stat(mean median n) columns(statistics)
Code:
egen grou = group(eventtime winner prefflag) forvalues i = 1/8 { estpost tabstat stakechange if grou == `i', stat(mean median n) columns(statistics) } esttab, cells("count mean p50") noobs nomtitles nonum
Comment