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   László Sándor <[email protected]>
To   [email protected]
Subject   Re: st: the fastest way to check if unique values of a variable > 100
Date   Mon, 26 Aug 2013 17:05:32 -0400

Thanks, Daniel.

I think your original one-liner was -cap as foo > 100 ,f-. This would
check for 100 unique values only if the values can only be positive
integers. Otherwise it leads to false positives (e.g. if I have only
two values, but one is 2321) or falls negatives (if I have 2000 values
of 0(0.01)19.99 ). That's what I meant.

On Mon, Aug 26, 2013 at 4:10 AM, daniel klein <[email protected]> wrote:
> I do not see why such an assumption should be necessary.
>
> If you are not happy with the expression, because you think that (for
> wahtever reasons) it does not fully capture your specific problem
> (which you do not clearly describe by the way), you simply modify it.
> This has nothing to do with -assert- and its speed as a built-in
> command.
>
> Anyway, checking your assumption of integer values only, is just one
> additional line away
>
> cap as foo = int(foo) ,f
>
> --
> Assert is fun, as always, if only I could assume that the values are
> always natural numbers starting at 0.
> *
> *   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/
*
*   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