[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: RE: RE: statalist-digest V4 #2935 - strange world

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: RE: statalist-digest V4 #2935 - strange world
Date   Tue, 8 Jan 2008 18:08:11 -0000

I don't think you should even try to solve a problem arising from a
particular syntax choice by letting that syntax mean something different
elsewhere, even in a particular context. That may be something some
people do much of the time in other fields, but it won't wash here. 

Otherwise put, new commands must be implemented using the rest of Stata,

and the issues here are entirely about (some of) the rest of 
Stata, namely the implementation of missing values 
and the treatment of inequalities. A new command cannot help. 

Stata already has a function -inrange()- (e.g. -inrange(y, z, .)-) that 
supplies the behaviour you want. It is not attractive 
to type, but it has none of the massive disadvantages
of other solutions or fantasies, some of which can not even fly in any

[email protected] 

Fred Wolfe

I have often thought that a solution to this problem would be to have
Stata create a new command in which  gen2 x = y > z would ignore z if
z .=.  It would save much typing for me, particularly in complex gen
statements, and it would be compatible with everything.


On 1/8/08, Nick Cox <[email protected]> wrote:
> Warnings are an interesting idea. In principle, I have
> absolutely no objections to StataCorp providing warnings
> if they can
> 1. Provide a way of turning them off too. Large, complex datasets,
> which means most of them, could otherwise be analysed only
> with a permanent cacophonous chorus in the background.
> 2. Devise fairly consistent criteria for what kinds of warnings
> are produced.
> 3. Be confident that this is more important as an extra feature
> than filling other longstanding gaps in Stata. If Stata 11
> doesn't include 3-D graphics, I will ... [Sorry, have to go now.]
> Nick
> [email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Austin
> Nichols
> Sent: 08 January 2008 17:15
> To: [email protected]
> Subject: Re: st: RE: RE: RE: statalist-digest V4 #2935 - strange world
> Nick--
> As usual, I agree with most of your points, but Allan raises a
> different objection--he does not want Stata to stop treating (.) as
> more than any finite number, or (.a) as more than (.), but only to
> report that it is doing so when a calculation or comparison involves
> missing values.  I think that warning messages are a very good idea,
> while changing Stata's logic is a very bad one.  This behavior of
> missing values seems to confuse enough people to justify a (small) set
> of warnings for these kinds of cases.  The trouble is, the warning
> message would have to trap every -if- qualifier on every command,
> which sounds like it could involve a lot of work.  Maybe just
> -generate- and -replace- would be a good start?  In that case, you
> would also want a warning message for a statement like
> . gen hirep=rep78>3
> On Jan 8, 2008 11:39 AM, Nick Cox <[email protected]> wrote:
> > I am with StataCorp on this, not that they need my
> > support.
> <snip>
> > Allan Reese
> > ===========
> >
> > Others have pointed out that "if x>y" in Stata evaluates as True
> x
> > is missing "."
> >
> > I've raised this before and had to accept as a feature of Stata that
> "."
> > is a big number and "computers do what you tell them, not what you
> > want."  Nevertheless, I remain of the opinion that it is
> > counter-intuitive, logically incorrect, and undoubtedly leads to
> > computer-assisted errors.  Changing the operation of Stata now would
> > inconvenience most current users, but it would not be inconsistent
> > the kernel were adapted to output a warning after such calculations
> > "Missing values included - check your results".
> *
> *   For searches and help try:
> *
> *
> *

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office  +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
[email protected]
*   For searches and help try:

*   For searches and help try:

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