Good time of day,
I'm sharing a small ado file for exporting results of the summarize command for all variables in data as a new dataset or as a DTA file using statsby.
I know that many people, including me, were researching this topic and other export commands like estpost - estout do not integrate with MS Excel very well.
The command, summarizeby, uses the same syntax as statsby and is available from SSC (ssc install summarizeby). Here are some examples:
This is my first contribution to SSC, please don't be too judgemental :-)
Let me know if something doesn't work or you require additional features (for example, I don't really use if and in with summarize or statsby). Thank you!
I'm sharing a small ado file for exporting results of the summarize command for all variables in data as a new dataset or as a DTA file using statsby.
I know that many people, including me, were researching this topic and other export commands like estpost - estout do not integrate with MS Excel very well.
The command, summarizeby, uses the same syntax as statsby and is available from SSC (ssc install summarizeby). Here are some examples:
Code:
* simple usage sysuse auto, clear summarizeby, clear * apply statsby syntax sysuse auto, clear summarizeby, clear by(foreign) * save into file sysuse auto, clear summarizeby, saving(summarise) * compare data sysuse auto, clear tempfile f summarizeby mean=r(mean) sd=r(sd), saving(`f') drop if mpg > 20 summarizeby mean=r(mean) sd=r(sd), clear append using `f', gen(id) order id label define data 0 "original" 1 "changed" label values id data * export to excel export excel * using "summarize.xlsx", firstrow(variables) replace
Let me know if something doesn't work or you require additional features (for example, I don't really use if and in with summarize or statsby). Thank you!
Comment