{smcl} {* 10oct2006}{...} {hi:help aggsum} {hline} {title:Title} {p 4 24 2}{cmd:aggsum} {hline 2} Summarize aggregated data {title:Syntax} {p 8 17 2} {cmdab:aggsum} [{it:function-list}] {ifin}, {opth by(varlist)} [ {opt f:ormat} ] {p 4 4 2}Where {it:function-list} is one or more functions (including parameters) recognized by {helpb egen}. {title:Description} {pstd}Let's say, to pick a random example out of thin air, that you wanted to know the distribution of hospital-median time-to-ekg, and you have patient level data. {cmd:aggsum} will give you that distribution: {pstd}{cmd:. aggsum median(t_to_ekg), by(hospital)} {pstd}Instead of, or in addition to, {cmd:median()}, any {cmd:egen} function that works with the {cmd:by} prefix could be used. Specifically: {p 8 8 2}{opth count(exp)}{break} {opth iqr(exp)}{break} {opth kurt(varname)}{break} {opth mad(exp)}{break} {opth max(exp)}{break} {opth mdev(exp)}{break} {opth mean(exp)}{break} {opth median(exp)}{break} {opth min(exp)}{break} {opth mode(varname)}{break} {opth pc(exp)}{break} {opth pctile(exp)}{break} {opth rank(exp)}{break} {opth sd(exp)}{break} {opth skew(varname)}{break} {opth total(exp)}{break} {pstd}The output of {cmd:aggsum} is identical to that of {cmd:summarize, detail}. The {opt f:ormat} option is also the same. {pstd}If the optional {it:function-list} is omitted, {opt count()} of the first {opt by()} variable is assumed. In other words, {pmore}{cmd:aggsum, by(ID)} {pstd}summarizes the number of records per ID. {title:Remarks} {pstd}The syntax is very non-standard, but, it was easy to do this way. Also, duplicating the non-detail version of {cmd:summarize} would have required more work. {title:Examples} {pstd}{cmd:. aggsum mean(height) median(height) mode(height), by(city) format} {pstd}{cmd:. aggsum mean(age) mean(heartrate) mean(bloodpressure), by(provider)} {pstd}{cmd:. aggsum, by(id)} {title:Also see} {pstd}Online: help for {help summarize}, {help egen} {pstd}Contact: {browse "mailto:elliott.lowy@va.gov":Elliott Lowy}