Date: Fri, 22 Sep 2006 10:28:02 -0700
Reply-To: adamwashere@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: adamwashere@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: Same program, different outputs.
In-Reply-To: <092220061638.6475.4514119C00010D720000194B220699973505029A06CE9907@comcast.net>
Content-Type: text/plain; charset="iso-8859-1"
Thank you for the helpful reply Ian.
I apologize for not mentioning more about the program and output
differences; I didn't want to bore or overload anyone with my initial
post.
As I mentioned briefly to Ya, the program models a patient population.
RANUNI is used extensively to determine whether an event happens to a
"patient", based on user-defined probabilities.
The output differences have been occurring at the end of the step in
which patients are "advanced" through time. At the beginning of the
step a seed is defined by "retain Seed1 123456789;". Anytime we need
to determine whether an event will happen to a patient throughout the
data step, we call a random number with, for example, "call ranuni
(seed1, prx133);" and then compare it to the probability of the event
occuring.
Each of these comparisons is contained within a loop in the data step.
The loop is iterated up to 30 times per patient, for 1500 patients.
The number of observations in the resulting data step is the first
point at which the program varies from run to run; 18876 observations
in one run, 19036 in another, 18885 on another computer, etc. This is
just the start of the differences; resulting outputs at the end of the
program - number of patients receiving treatment, for example - vary
slightly as well.
The reason I mention all of this is that I'm fairly certain that the
first execution of the function RANUNI should be the same from run to
run, computer to computer. I'm just not sure why the rest of the
program isn't following.
Thanks all,
Adam
Ian Whitlock wrote:
> Summary: Stability of RANUNI is discussed with reminder
> that data, system and history also determine
> results of a program.
> #value=2
>
> Adam,
>
> Without any knowledge of either your program or the kind of
> differences you see, I doubt if anyone can say anything that
> is very useful.
>
> In a DATA step the first execution of the function RANUI
> determines the initial seed so it affects all function RANUNI
> calls. You should not see changes in a subsequent step. But
> within that step conditional statements may determine which
> call is first.
>
> If %SYSFUNC(RANUNI(...)) is used then the first one executed
> affects all future calls within the session since the seed is
> stored in a global setting where you cannot get at it.
> In general, remember that the result of execution is determined
> by both code and data as well as the system. If the code doesn't
> change then it could be changes in the data or the system.
> Remember that system changes include changes in SAS options and
> other SAS global statements.
>
> Consequently the result of your code is dependent on SAS history.
> The same code in the same run can produce different results
> because the history of execution has changed.
>
> Ian Whitlock
> ===============
> Date: Fri, 22 Sep 2006 09:06:28 -0700
> Reply-To: adamwashere@GMAIL.COM
> Sender: "SAS(r) Discussion"
> From: adamwashere@GMAIL.COM
> Organization: http://groups.google.com
> Subject: Same program, different outputs.
> Comments: To: sas-l
> Content-Type: text/plain; charset="iso-8859-1"
> Hi all,
> I recently noticed that the SAS program with which I've been
> working is
> producing slightly different outputs each run. It occurs when
> the
> program is run, unchanged, on different computers, in different
> sessions, or back-to-back.
> My first guess at the root of the problem is that the program
> heavily
> utilizes the "call ranuni" function, but the function is seeded
> from a
> defined number which has never been changed. No other random
> number
> generators are called or used.
> Has anyone encountered this problem before?
> Adam
|