I have a problem decoding this, even setting
aside an example of Allan's puckish sense of humour.
One can certainly be bit by forgetting that
<expression evaluating to numeric missing>
qualifies as true. This may not be what you want,
but the point is very well documented.
However, if -x- is a string variable,
then I suspect that Stata will only allow conditions of
the form
if <strexp> <op> x
where <strexp> is a string expression
and <op> is an appropriate operator. Other
stuff will just be rejected as illegal syntax.
What is a bug in such circumstances
would seem to boil down to whether
the programmer has correctly codified
what they want, on which Stata is totally
clueless.
I suspect here we need a real example, not a
joke one.
Nick
[email protected]
Allan Reese
> Something which is definitely a feature, being a logical
> consequence of
> the language and documented, is that a missing value for a logical
> expression is treated as "true". However, I tripped over
> on it and that
> made me wonder if it is a dangerous feature - the
> implication is that any
> program must guard against the possibility. Consider, for
> example the
> consequences of missing data in code such as:
>
> if wmd invade x
>
> where x is a string variable.
>
> One approach is a self-imposed discipline to make a rigorous logical
> variable and test:
>
> if wmd==1 ...
>
*
* 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/