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 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 16 Sep 2010 22:56:31 -0400
Reply-To:   oloolo <dynamicpanel@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   oloolo <dynamicpanel@YAHOO.COM>
Subject:   Re: how to generate 1 to 100k random numbers without zeros?
Comments:   To: John.W@MEDISCIENCE.CO.UK

good to know that I was bothered by how to specify initial value for large (multidimensional) matrix in a DATA STEP

On Thu, 16 Sep 2010 21:19:15 +0100, John Whittington <John.W@MEDISCIENCE.CO.UK> wrote:

>At 14:39 16/09/2010 -0400, oloolo wrote: >>agreed, RANTBL is extremely slow when # of bins are large, say 100K. >>as for the syntax perspective, it accepts 'of...' style syntax, so I >>usually use array to avoid tedious list of probabilities: >> >>array _p{*} p1-p100; >>do j=1 to 100; _p[j]=0.01; end; >>seed=3454353; >>x=rantbl(seed, of _p[*]); > >It won't have any appreciable effect on performance (even with 100K bins), >but you could save yourself a little typing by assigning the values of the >array elements in the ARRAY statement, rather than in a separate DO loop: > >>array _p{*} p1-p100 (100*0.01) ; >>seed=3454353; >>x=rantbl(seed, of _p[*]); > > >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 >----------------------------------------------------------------


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