Date: Thu, 29 May 2008 18:48:20 -0700
Reply-To: "HXDAIC@gmail.com" <HXDAIC@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "HXDAIC@gmail.com" <HXDAIC@GMAIL.COM>
Organization: http://groups.google.com
Subject: Dynamic randomization remove aribitary assignment treatment A
Content-Type: text/plain; charset=ISO-8859-1
Hi there,
Following code I came up to dynamically assign treatment A or B to
subjects and make sure balance treatement between same fact.
Although it can work but the problem is that it is always arbitary
assign treatment A first if number of treatment A = number of
Treatment B in same fact.
data a;
do i=1 to 300;
do fact = mod ((i+ int(ranuni(0)*100)), 6); /*fact 0-5*/
output;
end;
end;
run;
data b;
array V V0-V5;
array VA VA0-VA5;
array VB VB0-VB5;
set a;
retain V0-V5 0 ;
retain VA0-VA5 0 ;
retain VB0-VB5 0 ;
do k = 1 to dim(v);
if k=(fact+1) then do;
V[k] = 1+ V[k];
TREATMENT= ifC((VA[k] LE VB[k]), 'A', 'B') ;
VA[k]=ifn((VA[k] LE VB[k]), VA[k]+1, VA[k]+0) ;
VB[K]=V[k]-VA[k];
end;
end;
run;
Q1: How to randomly assign treatment when No. of A already = No. of B
in same fact.
Q2: How to balance the total number of A and B at same time in
subjects.
Q3 : Is this follow the dynamic randomization rule?
Thanks in advance.