Date: Tue, 16 Nov 2004 16:37:41 -0500
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bob Abelson <Bob_Abelson@HGSI.COM>
Subject: Re: Random selection
Content-Type: text/plain; charset="iso-8859-1"
The easiest way, although far from the most efficient, would be to assign
a random number to each observation, sort by that number, and take the
first 150 of them.
retain seed 6345789;
randno = uniform(seed);
proc sort data=sample;
if _n_ <= 150;
I only recommend this with relatively small datasets, like yours. Larger
datasets need a more efficient technique.
Hope this helps.
240 314 4400 x1374
"Coffee falls into the stomach ... ideas begin to move, things remembered
arrive at full gallop ... the shafts of wit start up like sharp-shooters,
similies arise, the paper is covered with ink ..."
-- Honore de Balzac
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
11/16/2004 04:16 PM
Please respond to Myra
Subject: Random selection
I have a dataset of about 2800 observations & I need to randomly select
150 of them & output them into a new dataset. How would I go about doing
Thanks for any help.
Do you Yahoo!?
The all-new My Yahoo! ? Get yours free!