Block with Randomly Selected Block Sizes: A Flexible SAS® Macro Jimmy T. Efird, PhD, Center for Health Disparities Research and Department of Public Health, Brody School of Medicine, Greenville, NC

ABSTRACT Blocked Randomization is a commonly used technique in design to reduce bias and achieve balance in the allocation of participants to treatment arms of a study. However, when the investigator is not blinded and the block size is fixed, the allocation process is predictable. This paper provides a SAS® macro to perform blocked randomization with randomly selected block sizes.

INTRODUCTION Equipoise is the state of not knowing if a new experimental treatment is better or worse than placebo or a standard of therapy. The purpose of a randomized clinical trial (RCT) is to rule out chance as the explanation for observed treatment differences. Often a carefully conducted RCT is the only way to determine whether one treatment is statistically superior to another compound, especially when effect sizes are small and differences can not be readily ascertained in a natural history setting. Randomization is vital to the scientific integrity of a RCT. Randomizing participants is an effective of achieving balance between treatment arms of a study and of minimizing potential biases (both known and unknown) that could change the outcome of a trial independent of the treatment (Hoare 2002; Domanski and McKinlay 2009). An important aspect of randomization is to eliminate subjectivity in the selection of treatment. In the simplest case this is accomplished by flipping a fair coin and allocating participants to the experimental versus control group according to whether the outcome is heads or tails. However, by chance the number of participants receiving each drug many differ. For example, 75% of 10 coin tosses on average will result in an unequal number of heads and tails (Hoare 2002). Furthermore, the probably for imbalance in a simple randomization scheme increases for smaller sample sizes. Block randomization is a technique that is commonly employed in RCTs to minimize assignment differences between treatment arms of a study. The method involves randomly assigning participants within blocks based on an equal allocation ratio. For example, given a block size of 4, there are 6 possible ways to equally assign participants to a block. However, allocation may be predictable when the investigator of a study is not blind and the block size is known. That is, the treatment assignment that has so far occurred least often in the block likely will be the next chosen. Furthermore, unequal assignment may reduce the power of a statistical procedure to reject the null hypothesis as statistical power is maximized for equal group sample sizes. Accordingly, bias may be reduced by the use of random blocks and keeping the block size unknown to the investigator.

EXAMPLE Below, a SAS® macro is presented for performing a block randomization with randomly selected block sizes of 4, 6 and 8. The macro generates 15 randomized block allocations for 5 study sites. A larger number of blocks are created than is necessary in the event that the investigator surpasses the initially planned sample size. For example, continued enrollment might occur due to a greater than anticipated attrition rate. The macro works by invoking the ranuni function to equally partition the number of blocks according to a uniform distribution. When the number within the parenthesis of the ranuni function equals zero the seed is determined by the computer system clock. Thus, a difference set of block allocations occur each time the macro is executed. Changing the number to a positive integer will assure that the same block allocation is generated during subsequent use of the macro. After the block size is randomly determined the macro efficiently allocates treatment assignment equally within blocks by sorting on the looping index variable. Although the macro only generates 3 randomly selected block sizes the code may be easily modified to increase this number by further

1 partitioning the uniform assignment space. Similarly, the number of study sites and blocks may be increased or decreased by changing the upper of the two program do-loops.

SAS® macro code example for performing block randomization with randomly selected block sizes

%macro lp1(x); %do i=1 %to 5; %do j=1 %to 15; data blk; z=ranuni(0); if 00.6666 then blk=8; else blk=6; do j=1 to blk; x=ranuni(0); output; end; proc sort; by x; data a1; set blk; if _n_<=blk/2 then order='Treatment'; else order='Control '; proc sort data=a1; by j; data a1 (rename=(blk=blk_size)); set a1 (drop=j x z); proc print data=a1; title "Site=&i, Block=&j"; %end; %end; %mend lp1; %lp1(1); run;

DISCUSSION When designing a randomized clinical trial, careful consideration must be given to how participants are selected for various arms of a study. Standard statistical procedures typically are based on the assumption that the underlying data are independently distributed. Selection and accidental bias may occur when participants are not independently assigned to study groups with equal probability. Randomization provides an important foundation for valid by independently assigning participants to treatment groups. Achieving balance and minimizing the potential for bias are other key benefits of randomization. A simple random allocation scheme is a process by which each participant has equal likelihood of being assigned to treatment versus referent groups. However, by chance an unequal number of individuals may be assigned to each arm of the study and thus decrease the power to detect statistically significant differences between study groups. Block randomization is a technique used to achieve balance in the allocation of participants to treatment arms in a clinical trial, especially when the sample size is small. This method increases the probability that each arm will contain an equal number of individuals by sequencing participant assignments by block. However, the allocation process may be predictable when the investigator is not blind and the block size is fixed. For example, certain immunosuppressive drugs change color when exposed to light. This may inadvertently expose the identity of the compound in a clinical trial if the comparator compound is not light sensitive. Unmasking also may be intentional in the case of a physician chemically analyzing a patient’s blood to identify the randomized drug. Furthermore, blinding may not be possible in certain trials due to the nature of

2 the treatment or intervention. Accordingly, the random selection of block sizes may help maintain balance of treatment assignment and reduce the potential for selection bias. The SAS® macro presented in this paper provides an easy to use and efficient tool for performing a block randomization with random block sizes. A key advantage of this open source algorithm is that the underlying code may be modified to accommodate restricted randomization strategies yet to be implemented in standard statistical packages. A limitation of the macro is that sample size may vary by site but on average will be similar.

REFERENCES Hoare Z. Randomization: what, why and how? Significance 2010;7:136-138.

Domanski M, McKinlay S (eds). Successful Randomized Trials: A Handbook for the 21st Century. Philadephia, PA: Wolters Kluwer, 2009.

CONTACT INFORMATION Email: [email protected]; Mobile: 650.248.8282

SAS® is a registered trademark or trademark of SAS® Institute, Inc. in the USA and other countries. The symbol ® indicates USA registration.

3