Date: Wed, 1 Sep 2004 10:25:55 -0700
Reply-To: Dale McLerran <stringplayer_2@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <stringplayer_2@YAHOO.COM>
Subject: Re: Randomization Function that returns more than one number.
In-Reply-To: <000001c49040$81c737c0$6501a8c0@CONCEPTUALNESS>
Content-Type: text/plain; charset=us-ascii
Kim,
If you initialize a seed vector and pass that vector to the
ranbin function, then you get a vector of pseudo-random variates.
The code
proc iml;
seed = J(8,1,1234579);
y = ranbin(seed,1,0.5);
print y;
quit;
returns the vector Y with values shown below.
1
0
1
0
0
0
1
0
Dale
--- K Fernandes <kafernan@UWATERLOO.CA> wrote:
> Greetings,
>
> Is there a function or any speedy code out there that returns a list
> of
> randomly chosen numbers from a binary distribution? For example,
> using
> proc iml I would like a list (a 1D matrix) of 8 randomly chosen
> numbers,
> each either 1 or 0. Is there a way to get these 8 numbers in one step
> rather than via a loop with an assignment statement of
> ranbin(seed,1,0.5)?
>
> Thank you,
> Kim
>
=====
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@fhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
|