preserve. set printback=on. * SIMPLE AND COMPLEX RANDOM ASSIGNMENT IN EXPERIMENTAL DESIGNS Valentim R. Alferes, University of Coimbra (Portugal), 2009. * CO3.sps - Double carryover design (3 treatments; 6 sequences/units). set printback=off. set ovars labels onumbers values tvars labels tnumbers values. set errors=none. 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. data list free/v1(f8.0) v2(f8.0) v3(f8.0). begin data 1 2 3 2 3 1 3 1 2 end data. save outfile=outf1. set seed random. compute na1=uniform(1). rank na1(a)/print=no. formats rna1(f8.0). variable labels rna1"Random Permutation". summarize/tables=rna1/format=validlist nocasenum nototal /title='Random Permution for Square 1 Rows'/cells=none. sort cases by na1(a). save outfile=outf2. flip variables=v1 to v3. compute na2=uniform(1). rank na2(a)/print=no. formats rna2(f8.0). variable labels rna2"Random Permutation". summarize/tables=rna2/format=validlist nocasenum nototal /title='Random Permution for Square 2 Columns'/cells=none. sort cases by na2(a). string nome (a4). recode rna2 (1='v1') (2='v2') (3='v3') into nome. execute. flip variables=var001 to var003/newname=nome. save outfile=outf3. get file=outf1. string C1 C2 C3(A8). recode v1 to v3 (1='A') (2='B') (3='C') INTO C1 TO C3. execute. summarize/tables=c1 c2 c3/format=validlist nocasenum nototal /title='Square 1 \n Standard Latin Square'/cells=none. get file=outf2. string C1 C2 C3(a8). recode v1 to v3 (1='A') (2='B') (3='C') into c1 to c3. execute. summarize/tables=c1 c2 c3/format=validlist nocasenum nototal /title='Square 2 \n Random Permutation of Square 1 Rows'/cells=none. get file=outf3. string C1 C2 C3 (a8). recode v1 to v3 (1='A') (2='B') (3='C') into c1 to c3. execute. summarize/tables=c1 c2 c3/format=validlist nocasenum nototal /title='Square 3 \n Random Permutation of Square 2 Columns'/cells=none. save outfile=file5a. rename variables (C1=C3) (C2=C2) (C3=C1). save outfile=file5b. get file=file5a. execute. add files /file=*/file=file5b. execute. summarize/tables=c1 to c3/format=validlist nocasenum nototal /title='Squares 4A and 4B \n Double Carryover Design \n Final Latin Squares' /cells=none/footnote'The first square is identical to Square 3; the second' +' square is the reversal of Square 3 rows. \n If necessary, repeat the' +' syntax for each new set of 6 units.'. restore.