| Date: | Tue, 5 Sep 2000 12:41:22 -0700 |
| Reply-To: | "Huang, Ya" <ya.huang@AGOURON.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Huang, Ya" <ya.huang@AGOURON.COM> |
| Subject: | Be careful in using do loop (was How to the location of missing o
bservations) |
| Content-Type: | multipart/alternative;
|
|---|
To whomever might be interested,
In my previous post responding to Drifter's question,
I used do loop to create an index data set and merge
to old data set to find out the missing recorder,
syntaxly it is correct, but in reality SAS create a
slightly different number which caused some problem
in merge. In summary, a do loop as below will NOT create
the number expected:
data ind;
do num=0.01 to 0.15 by 0.01, 0.85 to 0.99 by 0.01;
output;
end;
if you use proc print, you will see num=0.01,0.02...0.06,...
but the real number for num=0.06 (and some others) are slightly
different, the difference is about 6.93889E-18 for num=0.06.
Because of the difference, merge will consider them as
different number.
A modified code will create the number required:
data ind (drop=i);
do i=1 to 15, 85 to 99;
num=i/100;
output;
end;
Ya Huang
[text/html]
|