Date: Thu, 1 Oct 1998 17:26:54 -0600
Reply-To: Mark S Dehaan <MSD@INEL.GOV>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Mark S Dehaan <MSD@INEL.GOV>
Subject: Re: random sample selection
Content-type: text/plain; charset=us-ascii
Melanie,
The basic idea is:
For every item in your population, pair it with a generated random variate
(ranuni is okay).
Then sort the data set by the random variate and use the first 20% (or
whatever) ordered
individuals.
psuedo code>
data samp; set pop;
ranvar=ranuni(34567);
run;
proc sort;
by ranvar;
run;
data mysamp; set;
if _n_ le (36*.2); *or whatever;
run;
HTH,
Mark DeHaan
Melanie Barish <MelliJ@AOL.COM> on 10/01/98 05:06:13 PM
Please respond to MelliJ@AOL.COM
To: SAS-L@UGA.CC.UGA.EDU
cc: (bcc: Mark S Dehaan/MSD/LMITCO/INEEL/US)
Subject: random sample selection
Hello everyone! Can anyone give me some suggestions as to the proper code
for
a random sample selection. Thus far, at the recommendation of a co-worker,
I
have used a ranuni command, followed by a data step with a retain
statement.
However, when attempting to select a 20% random sample, I am not getting
exactly 20%. For instance, when I select 20% of a data set that contains
36
observations, I get 9 observations. Thanks for the help...
Melanie Barish
Sr. Data Analyst
IPRO
Lake Success, NY
MelliJ@aol.com