Bookmark and Share

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: the fastest way to check if unique values of a variable > 100


From   daniel klein <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: the fastest way to check if unique values of a variable > 100
Date   Sun, 25 Aug 2013 22:43:39 +0200

Guess user-written approaches (or ados in general) are probably slower
than built-in commands like -tabulate-. I would go with -assert-

cap as foo > 100 ,f


Note that -capture- supresses output by default, so -quietly- is not needed.

Best
Daniel

-- 

Try -unique- or -distinct- from SSC.

On Sun, Aug 25, 2013 at 11:18 AM, László Sándor <[email protected]> wrote:
> Hi,
> Currently I think it is worth a quiet -cap tab- to catch the error
> r(134) or r(r). But it still can be a wasteful operation, as tabbing
> does work for many thousands of observations. And of course it does
> more than simply count the unique values.
>[...]
> Is there a fast approach I am not aware of?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index