LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 13 Sep 2010 20:26:08 -0700
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: how to generate 1 to 100k random numbers without zeros?
In-Reply-To:  <279E0CB25CBDEF4DB4A50E89328780E222F4B58E@CHEXCMS08.one.ads.che.org>
Content-Type: text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Viel, Kevin > Sent: Monday, September 13, 2010 3:00 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: how to generate 1 to 100k random numbers without zeros? > > > -----Original Message----- > > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > > Nordlund, Dan (DSHS/RDA) > > Sent: Monday, September 13, 2010 4:08 PM > > To: SAS-L@LISTSERV.UGA.EDU > > Subject: Re: how to generate 1 to 100k random numbers without zeros? > > > > I apparently missed this thread until now. Just a couple of > comments. > > > > 1. There was a question below of whether or not the ranuni() function > will > > return a zero. It will not. > > > According to the documentation: > > "The RANUNI function returns a number that is generated from the > uniform distribution on the interval (0,1)" > > Indeed, (0,1) does not include 0 and 1. However, this is inconsistent > with the uniform distribution as I know it, which includes its > endpoints, so I wonder if it should not be [0,1]. The probability of > selecting *any* point or set of points is zero, but it *can* happen. > In the case of the later, I suspect that the *limit* could be non-zero. > For instance, one could devise a infinite number of points, but still > not create intervals, whether open or close. > > We could do something akin to the search for the next largest prime, > that is each of us select a distinct non-zero seed and generate > RANUNI() streams until a zero is encountered. :) > > Or SI could chime in and tell use the actual RNG specifications :) > Kevin,

The SAS documentation does give the actual specification. I also give the specification on sasCommunity.org

http://www.sascommunity.org/wiki/How_the_SAS_Random_Number_Generators_Work

Software implemented pseudo-RNGs are always discrete, so any given random number generated by the RNG has a non-zero probability. Whether it is problematic that the SAS uniform RNG generates numbers on an open interval depends on what you need to do with those random numbers.

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204


Back to: Top of message | Previous page | Main SAS-L page