Date: Fri, 11 Dec 1998 08:36:46 -0900
Reply-To: AllenB@fishgame.state.ak.us
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "Allen E. Bingham" <AllenB@FISHGAME.STATE.AK.US>
Subject: Re: Why doesn't this work?
In-Reply-To: <B121CFE39697D111A07200805F9FB0D6F59AF5@RED-EXCH.amgen.com>
Content-Type: text/plain; charset="iso-8859-1"
I agree Hays MClean ... a floating point problem ... I used the following
code as a replacement ... which uses a put statement to format t1 to the
digits of accuracy that you wish to use in your comparison:
Code:
dm output 'clear';
dm log 'clear';
data test;
t2 = 5;
do t1 = 1 to 3 by 0.15;
output;
end;
run;
proc print;
title "Here is the full dataset";
run;
data test2;
set test;
ct1=put(t1,3.1);
if ct1 ne '1.3' then output;
else;
run;
proc print data=test2;
title "This should be missing the record where t1 = 1.3";
run;
Which resulted in:
Here is the full dataset
OBS T2 T1
1 5 1.00
2 5 1.15
3 5 1.30
4 5 1.45
5 5 1.60
6 5 1.75
7 5 1.90
8 5 2.05
9 5 2.20
10 5 2.35
11 5 2.50
12 5 2.65
13 5 2.80
14 5 2.95
This should be missing the record where t1 = 1.3
OBS T2 T1 CT1
1 5 1.00 1.0
2 5 1.15 1.2
3 5 1.45 1.5
4 5 1.60 1.6
5 5 1.75 1.8
6 5 1.90 1.9
7 5 2.05 2.0
8 5 2.20 2.2
9 5 2.35 2.3
10 5 2.50 2.5
11 5 2.65 2.6
12 5 2.80 2.8
13 5 2.95 2.9
Hope this helps.
----------------------------------
Allen E. Bingham, Biometrician
Alaska Department of Fish and Game
E-mail:
AllenB@fishgame.state.ak.us
---------------------------------
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@UGA.CC.UGA.EDU]On Behalf Of
> Lanning, Chris
> Sent: Friday, December 11, 1998 7:55 AM
> To: SAS-L@UGA.CC.UGA.EDU
> Subject: Why doesn't this work?
>
>
> Here is the code.
>
> dm output 'clear';
> dm log 'clear';
>
> data test;
> t2 = 5;
> do t1 = 1 to 3 by 0.15;
> output;
> end;
>
> proc print;
> title "Here is the full dataset";
>
> data test2;
> set test;
> if t1 ne 1.3 then output; /* Should be that if t1
> = 1.3 then this
> record is NOT output */
>
> proc print;
> title "This should be missing the record where t1 = 1.3";
>
> run;
>
>
> Here is the full dataset
>
>
> OBS T2 T1
>
> 1 5 1.00
> 2 5 1.15
> 3 5 1.30
> 4 5 1.45
> 5 5 1.60
> 6 5 1.75
> 7 5 1.90
> 8 5 2.05
> 9 5 2.20
> 10 5 2.35
> 11 5 2.50
> 12 5 2.65
> 13 5 2.80
> 14 5 2.95
>
>
>
> This should be missing the record
> where t1 = 1.3
>
>
> OBS T2 T1
>
> 1 5 1.00
> 2 5 1.15
> 3 5 1.30
> /* Hey what
> is this doing here????? */
> 4 5 1.45
> 5 5 1.60
> 6 5 1.75
> 7 5 1.90
> 8 5 2.05
> 9 5 2.20
> 10 5 2.35
> 11 5 2.50
> 12 5 2.65
> 13 5 2.80
> 14 5 2.95
>
>
> What is going on here? I am very confused, please help!!!
>
> Thanks in advance.
>
>
> Chris Lanning
> Trilogy Consultant
> clanning@amgen.com
> 1-805-447-0634
> SAS Consulting is my life!!!
>