|
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
>----------------------------------------------------------------
|