Date: Tue, 19 Dec 2000 12:41:43 -0500
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Division by missing (Zero).
On Tue, 19 Dec 2000 09:35:17 -0800, Huang, Ya <ya.huang@AGOURON.COM> wrote:
It's an interesting question, what that means: "handles very well...". All
in all the division by 0 or division by missing is a mathematical not
defined action! Maybe it would be better to have a kind of warning for
that!?
>Hi,
>
>Proc sql handle missing value very well, no error message,
>no warning, no stop execution, it even handles special missings:
>
>data t1;
>input c d e;
>cards;
>1 3 4
>3 . 4
>. 5 .
>.a 6 .c
>;
>
>options nocenter;
>
>proc sql;
>select *, c/d as av_cd, d/e as av_de
>from t1
>;
>
>--------------
>
>The SAS System 09:24 Tuesday, December 19, 2000 5
>
> c d e av_cd av_de
>-----------------------------------------------------
> 1 3 4 0.333333 0.75
> 3 . 4 . .
> . 5 . . .
> A 6 C . .
>
>Regards,
>
>Ya Huang
>
>-----Original Message-----
>From: Edward Heaton [mailto:HEATONE@WESTAT.COM]
>Sent: Tuesday, December 19, 2000 6:36 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Division by missing (Zero).
>
>
>Gabe, et. al.;
> I know it's Tuesday and this all started on Friday, but I've been off
>work. I'd like to suggest yet another suggestion.
>
> If D then Av_CD = C/D ;
>
>This will allow other missing values like .A, .B, ... .Z, ._ to be
>considered. (If D is 0 or missing then D is false, otherwise D is true.)
>
>Ed
>
>Edward Heaton, SAS Senior Statistical Systems Analyst,
>Westat (An Employee-Owned Research Corporation),
>1550 Research Boulevard, Room 2018, Rockville, MD 20850-3159
>Voice: (301) 610-4818 Fax: (301) 294-3992
>mailto:heatone@westat.com http://www.westat.com
>
>
>
>
>-----Original Message-----
>From: Lund, Pete [mailto:Peter.Lund@WSIPP.WA.GOV]
>Sent: Friday, December 15, 2000 3:38 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Division by missing (Zero).
>
>
>I might suggest a slight variation:
>
> if D not in(.,0) then Av_CD = C/D;
>
>This would allow for division by a negative number.
>
>Pete
>
>-----Original Message-----
>From: Cao, William [mailto:WCao@HRBLOCK.COM]
>Sent: Friday, December 15, 2000 12:29 PM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Division by missing (Zero).
>
>
> Data T1;
> Input C D E;
>
> If D > 0 then Av_CD= C/D;
> If E > 0 then Av_DE=D/E;
>
>Hope this helps.
>
>William Cao
>
> -----Original Message-----
> From: Shiferaw_G [mailto:Shiferaw_G@BLS.GOV]
> Sent: Friday, December 15, 2000 2:21 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Division by missing (Zero).
>
> I have a data set as follow:
>
> Data T1;
> Input C D E;
>
> Av_CD= C/D;
> Av_DE=D/E;
>
> When one of the variables is missing I get division by zero
>and the whole
> process is stopped. I want the process to continue with
>calculating the
> Average of those variables which values and skip or flag
>those with missing
> values. Is it possible to do that with SAS?
>
> Cards;
>
> 1 3 4
> 3 . 4
> . 5 .
>
> ;
>
> Thank U in Advance.
> Gabe
>
|