preserve. set printback=on. * SIMPLE AND COMPLEX RANDOM ASSIGNMENT IN EXPERIMENTAL DESIGN (Version 2.0) Valentim R. Alferes, University of Coimbra (Portugal), 2014. * BETWEEN-SUBJECTS DESIGNS. * Program: BRA-rb.sps Method 7: Blocked Random Assignment With One Blocking Variable - Design 2: Randomized Block Design - Design 3: Generalized Randomized Block Design - Design 8: Randomized Block Factorial Design - Design 9: Generalized Randomized Factorial Block Design - Design 15: Randomized Block Fractional Factorial Design - Design 19: Randomized Block Hierarchical Design - Design 21: Randomized Block Partial Hierarchical Design. set printback=off. set ovars labels onumbers values tvars labels tnumbers values. set olang=English small=0 errors=none decimal=dot. data list list/nblock (f8.0) ntreat(f8.0). /* User's Specifications /* * Enter number of blocks and number of treatments. begin data 8 3 end data. * Enter the number of units per treatment within each block * (1 unit for Designs 2, 8, 15, 19, and 21) * (2 or more units for Designs 3 and 9). compute ntblock=1. compute nublock=ntreat*ntblock. compute ncases=nblock*nublock. loop cases=1 to ncases. xsave outfile='%temp%\fout0'. end loop. get file='%temp%\fout0'. compute Block=mod(cases,nblock)+1. sort cases by block (A). compute Treatment=mod($casenum,ntreat)+1. set rng=mt mtindex=random. compute random=uniform(1). sort cases by block(a) random(a). compute id=$casenum. rank variables=id(a) by block/rank/print=no. compute Unit=rid. compute nutreat=ncases/ntreat. execute. formats all(f8.0). variable labels nblock'Number of Blocks' ntreat'Number of Treatments' nublock'Number of Units per Block' ncases'Number of Units per Experiment' nutreat'Number of Units per Treatment'. oms/select tables/if commands=["summarize"] subtypes=["case processing summary"]/destination viewer=no. oms/select tables/if commands=["crosstabs"] subtypes=["case processing summary"]/destination viewer=no. summarize/tables=nblock nublock ntreat nutreat ncases/format=nolist nototal /title="User's Specifications"/cells=first. summarize/tables=block unit treatment/format=validlist nocasenum nototal /title='Blocked Random Assignment \n Sorted by Block/Unit'+ '\n (Sequenial Assignment)'/cells=none. sort cases by treatment(a) block(a) rid(a). summarize/tables=block unit treatment/format=validlist nocasenum nototal /title='Blocked Random Assignment \n Sorted by Treatment/Block/Unit'+ '\n (Captive Assignment)'/cells=none. crosstabs/tables=block by treatment/count round cell. save outfile='%userprofile%\desktop\FinalDesign.sav'/keep=block unit treatment. get file='%userprofile%\desktop\FinalDesign.sav'. erase file='%temp%\fout0'. set printback=on. COMMENT Designs 2, 8, 15, 19, and 21 (Simple Block Designs): [Number de units per cell] = 1 Designs 3 and 9 (Generalized Block Designs): [Number de units per cell] > 1. restore.