Date: Wed, 3 Oct 2007 12:27:50 -0500
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: Random selection
In-Reply-To: <912ED977DA302D4F889A8DD10D5544DE02A548A5@afhe-ex.afhe.ualberta.ca>
Content-Type: text/plain; charset=ISO-8859-1
Do you have 1000 observations? Where each obs is an individual, and
you want to select 100 observations also called individuals.
data work._1kV / view=work._1kV;
do id = 1 to 1000;
output;
end;
retain other vars 1;
run;
proc surveyselect seed=52397001 out=work._100 n=100;
run;
proc print;
run;
Or do you have data with some unknown number of observations for 1000
individuals where total obs is greater than 1000. And you want to
select all observations for the selection of 100 individuals.
data work._1kplus;
do id = 1 to 1000;
do ae = 1 to ceil(ranuni(1234)*10);
output;
end;
end;
run;
proc summary data=work._1kplus nway;
class id;
output out=work.ids(drop=_:);
run;
proc surveyselect seed=52397001 out=work._100 n=100;
run;
data work.selected;
merge work._1kplus(in=in1) work._100(in=in2);
by id;
if in1 and in2;
run;
proc print;
run;
On 10/3/07, Navabi, Alireza <Alireza.Navabi@afhe.ualberta.ca> wrote:
> Hello all,
>
> In a SAS dataset of 1000 individuals, each with a number of variables
> recorded, how can I randomly select 100 individuals?
>
> Appreciating your help
>
> Alireza Navabi
>
> University of Alberta
>
>
>
|