Get 2 random samples same sex age education
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * Get two different random samples of cases having same sex, age and educ. INPUT PROGRAM. LOOP sex=1 TO 2. - LOOP age=25 TO 35. - LEAVE sex age. - LOOP #cnt=1 TO 40. - COMPUTE educ=RND(10+UNIFORM(8)). - END CASE. - END LOOP. - END LOOP. END LOOP. END FILE. END INPUT PROGRAM. SAVE OUTFILE='c:\\temp\\temp.sav'. SELECT IF ((sex=1) & (age=30) & (educ=10)). COMPUTE draw=UNIFORM(1). SORT CASES BY draw. * Replace the number 2 in next line by the size of your sample; keep the.5). COMPUTE sample = TRUNC($casenum/(2.5)). SELECT IF sample<3. EXECUTE. * The cases with the sample=0 form your first random sample. * The cases with the sample=1 form your second random sample. |
Related pages
...