Date: Mon, 28 Jun 2004 10:55:13 -0400
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Re: Independent Random Numbers
On Mon, 28 Jun 2004 05:50:04 -0700, Bruce Bradbury <BruceBrad@INAME.COM>
wrote:
>I want to generate two independent random uniform numbers in a data
>step. That is, independent of each other and without serial
>correlation.
>
>I see in the SAS online doc how to do this by using different seed
>variables and the call ranuni statement. However, in this case I want
>to use clock-initialised streams for both vectors of random numbers.
>Is there a simple way of doing this?
Hi, Bruce,
I have some codes, which I believe generate 100 observations with two
independent random variables, x1 and x2... but I am not quite sure. :-)
The idea is to use two call ranuni's with different seeds. The thing I am
not sure is that if they are serially correclated or not, since the two
seeds are derived from the same random number stream generated by the
ranuni() function. :-/
Cheers,
Chang
data one;
seed1 = int(1e4*ranuni(0));
seed2 = int(1e4*ranuni(0));
do i = 1 to 100;
call ranuni(seed1,x1);
call ranuni(seed2,x2);
output;
keep x1 x2;
end;
stop;
run;
/* check corr */
proc corr data=one;
var x1 x2;
run;
|