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
28
29
* Get 2 independent samples of cases meeting certain criteria.
* rlevesque@videotron.ca.
* www.spsstools.net

DATA LIST LIST /age sex educ prod2 prod3 prod4 total.
BEGIN DATA
1.00	1.00	10.00	.00	10.00	.00	33.00
1.00	1.00	10.00	25.00	.00	15.00	85.00
2.00	1.00	10.00	.00	.00	25.00	48.00
2.00	1.00	10.00	.00	24.00	.00	68.00
2.00	1.00	10.00	34.00	.00	21.00	55.00
2.00	1.00	10.00	67.00	.00	.00	81.00
2.00	1.00	10.00	.00	45.00	.00	45.00
2.00	1.00	10.00	12.00	78.00	.00	90.00
1.00	1.00	10.00	.00	.00	56.00	68.00
2.00	1.00	10.00	23.00	.00	56.00	79.00
END DATA.
LIST.

SELECT IF ((sex=1)&(age=2)&(educ=10)).
COMPUTE draw=UNIFORM(1).
SORT CASES BY draw.
* Replace the number 3 in next line by the size of your sample; keep the.5).
COMPUTE sample=TRUNC($casenum/(3.5)).
SELECT IF sample<2.
EXECUTE.

* The cases with the sample=0 form your first random sample.
* The cases with the sample=1 form your second random sample.