*# dat # @1hidata1@2Aggregate summarize@3 - summarize variables aggregated by other variables. # help *! 2Nov2006 program aggsum version 9.2 syntax [anything] [if] [in], by(varlist) local i 0 if mi("`anything'") { gettoken one: by capture confirm numeric var `one' if (_rc) local anything `"count(`one'~="")"' else local anything count(`one') } while ~mi("`anything'") { gettoken one anything: anything, bind tempvar t`++i' qui bysort `by': egen `t`i''=`one' `if' `in' label var `t`i'' `"`one' by(`by')"' local temps `temps' `t`i'' } tempvar tag egen `tag'=tag(`by') sum `temps' if `tag', d end