Date: Sat, 8 Nov 1997 21:40:57 -0600
Reply-To: mberger@STATS.GOVT.NZ
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: mberger@STATS.GOVT.NZ
Subject: Re: Random
Try this in SAS for selecting Simple Random Samples without Replacement
(SRSWOR).
You can use RANUNI as a function to get random numbers. RANUNI(0) uses the
current clock/time as a seed.
So, if your population data is in POP, and you want to select 1,000
observations SRSWOR, do the following;
DATA POP;
SET POP;
X=RANUNI(0);
PROC SORT DATA=POP;
BY RANUNI;
DATA SAMP;
SET POP;
BY RANUNI;
N+1; *** This is simply a sample counter;
IF N LE 1000 THEN OUTPUT;
You could probably make this more efficient but this should give the general
idea.