Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: logical missing as true


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: Re: logical missing as true
Date   Mon, 12 Jan 2004 13:13:12 -0500

At 04:38 PM 1/12/2004 +0000, Paul Seed wrote:
Some more thoughts:

As we have been reminded by Alan Reese & Nick Cox
Stata  consistently treats missing as true.

By contrast, all given SPSS's logical expressions are
correct if "missing" is read as "false".  Moreover, in their own words:"The
assignment is executed only if the logical expression is true."

However, I am not sure how SPSS evaluates "not missing".
I would expect SPSS to treat it as "missing".

If we are to change this, I would like two things:

A warning when missing values are evaluated in a logical expression

An option to reset the logical value of "missing" to either true (default),
false, or error.  If error is selected, evaluating logical expressions
including missing values will generate  an error code, and (usually)
stop execution of code.

If available, I would probably set missing = error in most programs,
as it is is almost always a mistake when I do not error-trap the
missing values.

Whatever else StataCorp decide to do, I would expect the current
Yet more thoughts:

I recall conversing with Bill Gould two years ago on this matter. He had an interesting idea, advocating the concepts of "definitely true" and "definitely false" in these situations. Under this scheme, missing would be neither true nor false. Thus, in...

if exp {
...
}
else {
...
}

if exp were missing, then neither the -if- nor the -else- part would get executed. (Maybe there could be a third section -- if-else-miss ?) Similarly, ...

do_something if exp

would include only those cases that are definitely true (equivalent to ...
do_something if exp & ~mi(exp)
under current Stata semantics), and

do_something if ~exp

would apply to only those that are definitely false (numeric 0). Again, those cases that evaluated to missing would be excluded from both of the above statements.

Currently, ~. is 0. The proposed scheme would require making ~. = . i.e., if an expression is missing, then so is its negation.

I hope this gets some of us thinking.
-- David

David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index