[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: speed question: -collapse- vs -egen-

From   Jeph Herrin <>
Subject   st: speed question: -collapse- vs -egen-
Date   Fri, 25 Apr 2008 15:37:21 -0400

I'm optimizing some code that needs to run often
for a simulation, and am wondering if I should
expect any difference in processing time between

 bys group: egen varmean=mean(myvar)
 bys group: keep if _n==1
 keep group varmean


 collapse (mean) varmean=myvar, by(group)

and if so, which would be faster?

I know I could run some tests myself, but figured
that others had either already done so or at least
would have some insight.

thanks in advance,

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index