Statalist


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

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


From   Jeph Herrin <[email protected]>
To   [email protected]
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

and

 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,
Jeph

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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