Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Equivalent of Excel's COUNTIF
From
Stas Kolenikov <[email protected]>
To
[email protected]
Subject
Re: st: Equivalent of Excel's COUNTIF
Date
Wed, 16 Nov 2011 11:44:40 -0500
On Wed, Nov 16, 2011 at 11:04 AM, Richard Herron
<[email protected]> wrote:
> Here is an alternative solution with -reshape-, -cond-, and -sum-.
Cute solution!
> The last two functions should be fast at any scale, but I don't have
> enough experience with Stata to know if -reshape- is faster than a
> loop.
That's easy to check: set obs 10M instead of 10, and see what will be
faster (and whether the -reshape- will start breaking down with large
data sets; it might or it might not). -reshape- appears to be using a
lot of I/O with explicit -use-, -save- and -merge- in the code; I
thought this would have been written in C or Mata -- there's a
reshape() function in Mata.
--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/