COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Re: missing numerical values = - infinity?

• Follow

```Robert:

FYI, Stata puts the missing values (for numeric variables)
at positive infinity.

I think every statistical package tries to find a way to let
comparision operators (<, =, >, etc.) return a binary (true
or false) result, even in the face of missing values.

Frankly, it's hard for me to imagine dealing with a third
return value from these operators. I think that would more
likely complicate than simplify matters.  More generally, I
have limited experience in programming languages, but the
ones I do know all generate a binary outcome from an IF test.

As a statistical package user, you have to write programs
that acknowledge the possibility of missing values.  For
your specific example, a good practice might be:

if not missing(birthweight) then
low_birth_weight=(birth_weight<2500);

This will let low_birth_weight be unchanged (and as a "new"
variable it would be initialized to missing) if birthweight
is missing.  Otherwise it gets the dummy values you want.
And this logic would work regardless of whether missing is
a negative or positive infinity.

Regards,
Mark

> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Robert Feyerharm
> Sent: Wednesday, December 23, 2009 3:52 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: missing numerical values = - infinity?
>
> Going into rant mode... I discovered a feature of SAS that I wish I had
> known earlier: SAS will assign a value of *negative infinity* to
> missing
> numerical values in logical statements.
>
> So in the following code:
>
> if birth_weight<2500 then low_birth_weight=1;
> else if birth_weight>=2500 then low_birth_weight=0;
>
> SAS will assign all missing values (birth_weight=.) to the category
> low_birth_weight=1, since negative infinity is less than 2500.
>
> Why SAS programmers settled on this convention I don't know. Wouldn't
> it
> make more sense if birth_weight=., then low_birth_weight=.?
>
> At any rate, the good news is that it's easy to correct the above code:
>
> if 0<birth_weight<2500 then low_birth_weight=1;
> else if birth_weight>=2500 then low_birth_weight=0;
>
> Robert Feyerharm
> Oklahoma State Department of Health
```
 0
Reply mkeintz 12/23/2009 10:19:16 PM

```The documentation clearly states that "a missing value for a numeric
variable is smaller than all numbers" - it's said that at least since the
1970's.  Sometimes (almost always), it helps to RTFM.

The closest thing to missing values in ORACLE is the concept of null values,
and as I recall, no operations are possible using null values.

In ORACLE if A and B are both null values, a statement like IF A = B THEN .
.. . results in A and B not being equal because comparisons using null values
are not possible, and the portion of the statement following THEN does not
get executed.

In SAS, if A and B are both missing values (with the added slight
complication of special missing values) then A is judged equal to B and the
portion of the statement following THEN does get executed.

As to why SAS programmers settled on this convention - it seems more
generally useful than something like the ORACLE convention.

no new material below - included for reference only

""Keintz, H. Mark"" <mkeintz@WHARTON.UPENN.EDU> wrote in message
> Robert:
>
>
> FYI, Stata puts the missing values (for numeric variables)
> at positive infinity.
>
> I think every statistical package tries to find a way to let
> comparision operators (<, =, >, etc.) return a binary (true
> or false) result, even in the face of missing values.
>
> Frankly, it's hard for me to imagine dealing with a third
> return value from these operators. I think that would more
> likely complicate than simplify matters.  More generally, I
> have limited experience in programming languages, but the
> ones I do know all generate a binary outcome from an IF test.
>
> As a statistical package user, you have to write programs
> that acknowledge the possibility of missing values.  For
> your specific example, a good practice might be:
>
>  if not missing(birthweight) then
>    low_birth_weight=(birth_weight<2500);
>
> This will let low_birth_weight be unchanged (and as a "new"
> variable it would be initialized to missing) if birthweight
> is missing.  Otherwise it gets the dummy values you want.
> And this logic would work regardless of whether missing is
> a negative or positive infinity.
>
>
> Regards,
> Mark
>
> > -----Original Message-----
> > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> > Robert Feyerharm
> > Sent: Wednesday, December 23, 2009 3:52 PM
> > To: SAS-L@LISTSERV.UGA.EDU
> > Subject: missing numerical values = - infinity?
> >
> > Going into rant mode... I discovered a feature of SAS that I wish I had
> > known earlier: SAS will assign a value of *negative infinity* to
> > missing
> > numerical values in logical statements.
> >
> > So in the following code:
> >
> > if birth_weight<2500 then low_birth_weight=1;
> > else if birth_weight>=2500 then low_birth_weight=0;
> >
> > SAS will assign all missing values (birth_weight=.) to the category
> > low_birth_weight=1, since negative infinity is less than 2500.
> >
> > Why SAS programmers settled on this convention I don't know. Wouldn't
> > it
> > make more sense if birth_weight=., then low_birth_weight=.?
> >
> > At any rate, the good news is that it's easy to correct the above code:
> >
> > if 0<birth_weight<2500 then low_birth_weight=1;
> > else if birth_weight>=2500 then low_birth_weight=0;
> >
> > Robert Feyerharm
> > Oklahoma State Department of Health

```
 0
Reply Lou 12/27/2009 4:50:06 PM

1 Replies
320 Views

(page loaded in 0.075 seconds)

Similiar Articles:

7/26/2012 10:47:05 AM