LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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.


Back to: Top of message | Previous page | Main SAS-L page