Hi,
I run into something interesting. I have a data set as
qid a b c
DP005205 0.49 -2 0.019
DP005206 0.934 -1.793 0.095
DP005207 0.888 -0.073 0.024.
Then in order to use them in another data set, I put the three records into one record data set as
qqid1 qqid2 qqid3 a1 a2 a3 b1 b2 b3 c1 c2 c3
DP005205 DP005206 DP005207 0.49 0.934 0.888 -2 -1.793 -0.073 0.019 0.095 0.024
In the third data set, I retrieved the one record and tried to put the data in four arrays as qid, a, b, and c and output the result to log to check if the data were correctly retrieved. Following is the related piece of code
if _N_ = 1 then do;
set itemarr;
retain qqid1-qqid%left(&itemno.) a1-a%left(&itemno.) b1-b%left(&itemno.) c1-c%left(&itemno.);
array qqid (*) qqid1-qqid%left(&itemno.);
array a (*) a1-a%left(&itemno.);
array b (*) b1-b%left(&itemno.);
array c (*) c1-c%left(&itemno.);
do i = 1 to &itemno.;
if qqid(i) ne '' then put qqid(i) a(i) b(i) c(i);
end;
end;
The macro variable &itemno.=3 here. But the log shows the retrieved result with two incorrect b values -2 and -0 as
qid a b c
DP005205 0.49 -2 0.019
DP005206 0.934 -2 0.095
DP005207 0.888 -0 0.024
It seems the problem is associated with rounding. But why only these two values cannot be retrieved correctly?
Thanks
Ming