*! version 1.1.2 07oct2022

Title

summarizeby -- Extend statsby
for summarize with the same syntax but no ": command"

Examples

. sysuse auto, clear

* simple example, collect all statistics returned by summarize
. summarizeby, clear

* same example with by()
. summarizeby, clear by(foreign)

* detailed example, collect all statistics returned by summarize
. summarizeby, clear detail

* save main statistics into a DTA file
. summarizeby mean=r(mean) sd=r(sd) min=r(min) max=r(max), saving(stats)

* compare and contrast main statistics for two datasets
. tempfile tmpf
. preserve
. summarizeby mean=r(mean) sd=r(sd) if mpg > 20, saving(`tmpf')
. restore
. summarizeby mean=r(mean) sd=r(sd), clear
. append using `tmpf', gen(id)
. order id
. label define dataset 0 "full" 1 "reduced"
. label values id dataset

* export to excel
. export excel * using "stats.xlsx", firstrow(variables)

Author

Ilya Bolotov

Prague University of Economics and Business

Prague, Czech Republic

ilya.bolotov@vse.cz

Thanks for citing this software and my works on the topic:

Bolotov, I. (2020). SUMMARIZEBY: Stata module to use statsby functionality with
summarize. Available from
https://ideas.repec.org/c/boc/bocode/s458870.html.