Date: Wed, 23 Dec 2009 15:52:28 -0500
Reply-To: Robert Feyerharm <robertf@HEALTH.OK.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robert Feyerharm <robertf@HEALTH.OK.GOV>
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