******************************************************************************* * This program in SAS provides a permuted blocks randomization scheme for * * equal allocation of two treatments, denoted as A and B. * * * * The user needs to specify values for the desired sample size (samplesize), * * the maximum block size (blocksize = a number divisible by 2), and an * * indicator as to whether the block size is fixed or random (randomblocksize * * = 0 or 1, respectively). * *******************************************************************************; data values; samplesize=108; maxblocksize=6; randomblocksize=1; run; data randomization_plan; set values; interim_ss+0; do while(interim_ss<=samplesize); block+1; blocksize=maxblocksize; if randomblocksize=1 then do; blocksize=ceil(maxblocksize*ranuni(0)); if mod(blocksize,2)=1 then blocksize=blocksize+1; end; interim_ss=interim_ss+blocksize; na=round(blocksize/2); nb=blocksize-na; nna=0; nnb=0; do i=1 to blocksize by 1; subject+1; if nna=na then treatment="B"; if nnb=nb then treatment="A"; else do; aprob=(na-nna)/(na+nb-nna-nnb); u=ranuni(0); if (0<=u<=aprob) then do; treatment="A"; nna=nna+1; end; if (aprob