Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

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


From   Phil Schumm <pschumm@uchicago.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: A modest proposal - missing data doesn't count
Date   Mon, 14 Jun 2010 15:22:43 -0500

On Jun 14, 2010, at 2:49 PM, Nick Cox wrote:
-inrange()- is a well-defined function available for comparisons.

On Jun 14, 2010, at 2:54 PM, Martin Weiss wrote:
I got used to the -!mi()- thing in "bigger-than" comparisons after a couple of errors in this area, and I do not even regard it as a hassle anymore. What is all the fuss about?


Personally, I use both of these, depending on the context. If, say, I want to generate an indicator variable for when y takes (non-missing) values larger than 10, then I typically use

    gen byte x = (10 < y) if !mi(y)

which makes it clear that I am defining a variable which is missing if y is missing. Alternatively, if I want to map the non-missing values of y into some other variable, I use

    recode y min/10=1 11/50=2 51/max=3, gen(x)

or, if I just want to refer to a specific range of values,

    if inrange(y,51,maxdouble())


-- Phil

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index