Statalist


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

Re: st: Teach an old dog new tricks


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Teach an old dog new tricks
Date   Thu, 8 May 2008 13:20:22 -0400

Sergiy--
I devised the code specifically for your query, because it seemed the
most straightforward answer.  Given your expressed hope, I won't make
the same mistake again.

-summarize, meanonly- (even N*M times) is very fast; if you wanted an
even faster solution, you could -sort- the data and use -in-
restrictions instead of -if-, use -collapse, fast-, or use Mata.

On Thu, May 8, 2008 at 12:28 PM, Sergiy Radyakin <[email protected]> wrote:
> Thank you Austin.
>
>  But your code will call summarize NxM times, where N and M are the
> numbers of categories within each variable specified in by() and each
> time summarize will look through the whole dataset. And this is where
> the efficiency is lost. I believe there is only one loop through the
> dataset necessary in this case, regardles of N and M.
>
> I just hope you've had the code already and didn't devise it
> specifically for my query.
>
> Thank you, Sergiy Radyakin
*
*   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