******************************************************************************* * 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 (sampsize) * * and the desired block size (blcksize). * *******************************************************************************; data values; samplesize=48; blocksize=6; run; data random; set values; nblocks=round(samplesize/blocksize); na=round(blocksize/2); nb=blocksize-na; do block=1 to nblocks by 1; nna=0; nnb=0; do i=1 to blocksize; subject=i+((block-1)*blocksize); 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