>>>>>>>> SAS Notes -- Copyright (c) 1991 - 1998 by SAS Institute Inc. <<<<<<<<
V7-FUNCTION-0238 *** ALERT NOTE *** PRODUCT: STAT
PROCEDURE: FUNCTION
TITLE: RANBIN Function Can Return Incorrect Results
KEYS: RANBIN FUNCTION RETURN INCORRECT RESULTS
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 2nd 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 7.00 TS501
CMS 7.00 TS501
DigitUnx 7.00 TS501
HP800 7.00 TS501
MVS 7.00 TS501
OS/2 7.00 TS501
Solaris 7.00 TS501
VMS/AXP 7.00 TS501
VMS 7.00 TS501
WIN/NT 7.00 TS501
Win98 7.00 TS520
Win95 7.00 TS501
This archive was generated by hypermail 2b29 : Mon Jan 10 2000 - 10:10:18 EST