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/