>>>>>>>> SAS Notes -- Copyright (c) 1991 - 1998 by SAS Institute Inc. <<<<<<<<
V6-FUNCTIONS-F469 *** ALERT NOTE *** PRODUCT: BASE
PROCEDURE: FUNCTIONS
TITLE: RANBIN Function Can Return Incorrect Results
KEYS: RANBIN FUNCTION RETURN INCORRECT RESULTS ROUND INT FUZZ INTEGER STAT
STATISTICS PROBABILITY
The RANBIN function can return incorrect results under certain
circumstances. If the 2nd argument, N, of the RANBIN function is not
exactly an integer but is represented by a number in the interval
I-1e-12 <= N < I (where I is any integer) then RANBIN will incorrectly
use N-1 as the 2nd argument. For example,
data _null_;
n=12;
wrong=ranbin(12345,n-.0000000000001,.99999999);
right=ranbin(12345,n,.99999999);
put wrong= right=;
run;
will return the correct value of 12 for RIGHT and will return the
incorrect value of 11 for WRONG.
This problem is most likely to occur when the second argument to the
RANBIN function is being calculated in the DATA step. To circumvent the
problem, apply the INT function to the 2nd argument. In
the example above, change the calculation of WRONG to
wrong=ranbin(12345,int(n-.0000000000001),.99999999);
+------REPORTED------+ +---FIXED---+
SYSTEM RELEASE LEVEL RELEASE LEVEL
AIX/R 6.12 TS020
DigitUnx 6.12 TS040
HP800 6.12 TS020
Macintosh 6.12 TS040
OS/2 6.12 TS020
Solaris 6.12 TS020
VMS/AXP 6.12 TS020
Windows 6.12 TS020
WIN/NT 6.12 TS020
Win95 6.12 TS020
This archive was generated by hypermail 2b29 : Mon Jan 10 2000 - 10:10:18 EST