Date: Wed, 3 Dec 2003 11:04:45 -0500
Reply-To: Peter Flom <flom@NDRI.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Flom <flom@NDRI.ORG>
Subject: Re: THANKS***PROBLEM USING RANUNI AND FLOOR FUNCTION TOCREATE
FAKE DATA***
Content-Type: text/plain; charset=US-ASCII
This is certainly one of the poorest areas of SAS documentation. I
remember having to figure a lot of this out for my dissertation, but I
wouldn't want to have to fiugre it out again! :-)
Is anyone from SAS listening in?
Peter
Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)
>>> Ian Whitlock <WHITLOI1@WESTAT.COM> 12/3/2003 10:58:08 AM >>>
John,
I can well imagine that the version 6 documentation is sometimes
clearer
than version8. Is there any version that makes it clear that all the
random
number functions are linked to the same seed? Consider
15 data _null_ ;
16 x = ranuni ( 12345 ) ;
17 y = rannor ( 88888 ) ;
18 put y= ;
19 run ;
y=0.373945642
NOTE: DATA statement used:
real time 0.07 seconds
cpu time 0.00 seconds
20
21 data _null_ ;
22 y = rannor ( 88888 ) ;
23 put y= ;
24 run ;
y=0.008280087
NOTE: DATA statement used:
real time 0.00 seconds
cpu time 0.00 seconds
So the seed stream is determined once in each DATA step. Now suppose
you
use execute random number functions using %SYSFUNC somewhere. Anyone
care
to find the documentation on how many streams are possible?
IanWhitlock@westat.com
-----Original Message-----
From: John Whittington [mailto:John.W@MEDISCIENCE.CO.UK]
Sent: Tuesday, December 02, 2003 11:39 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: THANKS***PROBLEM USING RANUNI AND FLOOR FUNCTION TOCREATE
FAKE
DATA***
At 15:11 02/12/03 -0700, Jack Hamilton wrote:
>Actually, the CALL RANUNI online documentation refers one to the
"Seed
>values" documentation - so the needed information is three levels
down,
>and not stated directly even there.
I must confess that I was looking at the v6 hardcopy Language
Reference,
which is my first line of reference for most things!
>The documentation says "If you supply a different seed value to
>initialize each of the seed variables, the streams of the generated
>random numbers are computationally independent. With a function,
>however, you cannot generate more than one stream by supplying
multiple
>seeds within a DATA step. The following two examples illustrate the
>difference.".
Yes, that's slightly less clear than the V6 documentation I quoted,
which
said:
"".... The CALL RANUNI statement produces a separate stream for each
seed,
while the RANUNI function produces only a single stream of random
variates,
even with multiple RANUNI function occurrences in the same DATA step."
As you'll see, although there was still a bit of potential confusion,
in
that the first pasrt of the sentence refers to multiple seeds with
CALL
RANUNI, the second part of the sentence is very clear in saying that
the
RANUNI function can produce only a single stream, even if there are
multiple
occurrences of the function (which, I would say, by implication, means
regardless of whether the seeds are the same or different).
>In the case given below, there aren't two different seeds, there's
only
>one (the constant 12345), so it's not obvious that using one seed
twice
>will have the same effect as using two different seeds. The
>documentation is technically correct, but it's misleading.
Actually, I don't think it's really all that misleading. The online
documentation you quote makes it clear that the function can't create
more
than one stream in one DATA step by having different seeds. If it
can't
produce more than one stream even when the seeds are different (when
one
might possibly expect multiple streams), one surely would not expect
that it
would produce multiple streams when the seeds were the same, would
one?
Kind Regards
John
----------------------------------------------------------------
Dr John Whittington, Voice: +44 (0) 1296 730225
Mediscience Services Fax: +44 (0) 1296 738893
Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk
Buckingham MK18 4EL, UK mediscience@compuserve.com
----------------------------------------------------------------