Date: Fri, 21 Sep 2007 11:31:07 -0700
Reply-To: "Pardee, Roy" <pardee.r@GHC.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Pardee, Roy" <pardee.r@GHC.ORG>
Subject: Re: How to randomly divide sample in 2 groups
In-Reply-To: A<200709211752.l8LGBvqM018637@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"
No doubt there are fancier ways, but something like this should work:
Data have ;
set have ;
randy = uniform(123456) ;
Run ;
Proc sort data = have ;
by randy ;
Run ;
Data want ;
set have ;
if _n_ le 200 then condition = 'control' ;
else condition = 'case' ;
Run ;
Proc freq data = want ;
tables condition / missing ;
Run ;
HTH
-Roy
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sophia Tong
Sent: Friday, September 21, 2007 10:53 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to randomly divide sample in 2 groups
Dear all,
I have 400 people in a pool, want to randomly assign them into 2
groups, 200 each without any restrictions. What's right way of doing it?
I have tried somthing like
DATA want;
SET have;
SEED=339487731;
R=RANUNI(SEED);
R2=ROUND(1+R);
RUN;
But the R2 won't give me 200/200. Please help.
Thanks,
Sophia