Date: Thu, 27 Apr 2000 21:17:12 -0400
Reply-To: Jay Weedon <jweedon@EARTHLINK.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jay Weedon <jweedon@EARTHLINK.NET>
Organization: http://extra.newsguy.com
Subject: Re: Random sample
Content-Type: text/plain; charset=us-ascii
The indexing I specified in the first data step does the sorting
implicitly, so no prob there.
And if the various random number generator functions are all equally
"random" it won't make any diff. what prob. distribution I use!
Jay.
On Thu, 27 Apr 2000 16:13:16 -0400, Frank Mwaniki/PH/Novartis wrote:
>You need to sort the new dataset by the random number before you extract the
>random sample. Also note that "ranuni" a one of a number of functions you can
>use to generate a random indicator.
>
>HTH Frank
>
>
>
>
>Jay Weedon <jweedon@EARTHLINK.NET> on 04/27/2000 02:46:13 PM
>
>Please respond to Jay Weedon <jweedon@EARTHLINK.NET>
>
>To: SAS-L@LISTSERV.UGA.EDU
>cc: (bcc: Frank Mwaniki/PH/Novartis)
>Subject: Re: Random sample
>
>
>
>
>Dear SJ,
>
>data scratch (index=(randno));
> set old;
> randno=ranuni(0);
>run;
>
>data new;
> set scratch (obs=x);
> by randno; drop randno;
>run;
>
>where "x" is the (integer) number of records desired. Depending on
>what you need to do, you may need to resort the output data set.
>
>Jay Weedon.
>
>On Thu, 27 Apr 2000 17:57:34 +0100, "Sunny Jim" <jez@jbassett.co.uk>
>wrote:
>
>>Does anyone have any decent code to pick x random records from a dataset. I
>>just cannot find that program I wrote.
>>
>>Thanks
>>
>>Sunny Jim
>>
>
>
>
>
>
>
|