Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: RE: A modest proposal - missing data doesn't count

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: RE: A modest proposal - missing data doesn't count
Date   Mon, 14 Jun 2010 20:57:18 +0100

The fuss is that 

if x > 10 

includes x >= . Numeric missings all count as larger than any
non-missing numeric value. 


Martin Weiss

I got used to the -!mi()- thing in "bigger-than" comparisons after a
of errors in this area, and I do not even regard it as a hassle anymore.
What is all the fuss about?

Nick Cox

This comes up on the list, understandably, about once a year. 

I think everybody has some, indeed much, sympathy with the problem, but
no-one ever likes anybody else's solution. 

To make even a case for his new function, Allan has got to show that it
gives sensible answers in all situations in which it might be applied,
and not just inequalities. Just as it's a feature that the name
-value()- is not bespoke, it is also a weakness that it carries no
meaning that is utterly evident and precise. For example, is value(.)
the same or different from value(.a)? Does value(x) < 10 include or
exclude missings? If they're excluded too, then Allan wants a three-way
logic in Stata, and the quickest way to get that is to write your own
clone of Stata. (Allow 25 years.) 

(If this isn't Phil Schumm's point, it's very close.) 

-inrange()- is a well-defined function available for comparisons. I
don't think many people use it, perhaps because its detailed rules don't
stick in one's memory. By the time most people have looked up the syntax
they could write out a longer expression avoiding it. 

I think -value()- could hardly jump such a hurdle. 


Allan Reese

Feeling aggrieved at years of typing expressions like "if x>10 & x<.",
and feeling sure there must be lots of wrong results from Stata because
users didn't notice that "x>10" includes cases with the missing value,
might I request a new code function?  

The name value() is available. While users would have to remember to use
it, it would quickly become a habit to type "if value(x)>10" etc, with
the effect that the expression would evaluate as true only when x had a
non-missing value.  A check box could be added to the menu interface as
a reminder.    

*   For searches and help try:

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