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: RE: if qualifier
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: RE: if qualifier
Date
Wed, 10 Jul 2013 16:26:00 -0400
Sarah Edgington <[email protected]>:
Incorrect. Joseph already explained that (10<mpg) is 1 for every observation.
And "if 10<mpg<20" is the same as "if (10<mpg)<20" of course.
And 1 is always less than 20.
Try
sysuse auto, clear
count if 10<mpg<2
count if 10<mpg<1
count if 12<mpg<1
On Wed, Jul 10, 2013 at 4:15 PM, Sarah Edgington <[email protected]> wrote:
> Elan,
> It appears to be just ignoring the <20.
> That is, it's that same result as -count if 10<mpg-
> I'm also surprised it doesn't give an error (I'd expect "invalid <20").
> -S
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Cohen, Elan
> Sent: Wednesday, July 10, 2013 12:24 PM
> To: [email protected]
> Subject: st: if qualifier
>
> All,
>
> I'm not sure what to make of the following:
>
> sysuse auto
> count if 10<mpg<20
>
> A SAS-using colleague of mine typed this into Stata. Much to her
> astonishment, it returned a valid yet incorrect answer. Much to my
> astonishment, it did not return an error.
>
> What is Stata doing here? Is this behavior documented anywhere?
>
> - Elan
*
* 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/