LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page