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]

st: RE: RE: if qualifier


From   "Cohen, Elan" <cohened@upmc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: if qualifier
Date   Wed, 10 Jul 2013 20:29:57 +0000

A few more examples that helped me through this:

. di 0<1<2
1
// 0 is less than 1 which evaluates to true, or 1
// 1 is less than 2 which evaluates to 1

. di -4<-3<0
0
// -4 is less than -3 which evaluates to true, or 1
// 1 is not less than 0 which evaluates to 0


Thanks for your help.

- Elan


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Sarah Edgington
Sent: Wednesday, July 10, 2013 16:16
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: if qualifier

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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Cohen, Elan
Sent: Wednesday, July 10, 2013 12:24 PM
To: statalist@hsphsun2.harvard.edu
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


--
Elan D Cohen, MS
Center for Research on Health Care Data Center University of Pittsburgh 



*
*   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/


*
*   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