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 (May 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 20 May 2003 14:45:11 -0700
Reply-To:     Ramesh Makkena <makkena@XOMA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Comments:     To: "Huang, Ya" <yhuang@AMYLIN.COM>
From:         Ramesh Makkena <makkena@XOMA.COM>
Subject:      Re: Best way to test missing value?
Comments: To: SAS-L@LISTSERV.VT.EDU
Content-Type: text/plain; charset="iso-8859-1"

Ya,

I always use missing function instead of . If you use missing(a) then you would be fine.

1 data _null_; 2 a=.; 3 b=(a=.); 4 put a= b=; 5 a=.k; 6 b=(a=.); 7 put a= b=; 8 a=.k; 9 b=(nmiss(a)=1); 10 put a= b=; 11 a=.k; 12 b=(missing(a)); 13 put a= b=; 14 run;

A=. B=1 A=K B=0 A=K B=1 A=K B=1 NOTE: DATA statement used: real time 0.51 seconds cpu time 0.03 seconds

Ramesh Makkena

-----Original Message----- From: Huang, Ya [mailto:yhuang@AMYLIN.COM] Sent: Tuesday, May 20, 2003 9:59 AM To: SAS-L@LISTSERV.VT.EDU Subject: Best way to test missing value?

Hi there,

I usually use "if a=. then ..." to test if a variable's value is missing, but was burned today, because one of the var has many different missing values, as a result "if a=. then .." failed to detect a=.k. I then use "if nmiss(a)=1 then ..", which works fine. I just wonder how you guys handle this kind of situation.

61 data _null_; 62 a=.; 63 b=(a=.); 64 put a= b=; 65 a=.k; 66 b=(a=.); 67 put a= b=; 68 a=.k; 69 b=(nmiss(a)=1); 70 put a= b=; 71 a=.k; 72 b=(a = missing); 73 put a= b=; 74 run;

NOTE: Variable missing is uninitialized. a=. b=1 a=K b=0 a=K b=1 a=K b=0

I vaguely remember seeing someone use 'missing' as a key word, but the above log shows it dose not work.

Thanks

Ya


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