1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
* Get random sample of 40 cases from each stratum.
* although there are only 2 groups in the following example, the same procedure works
* for any number of groups.
* Posted to SPSSX-L by Raynald Levesque on 2005/06/18 
* http://www.spsstools.net

INPUT PROGRAM.
LOOP id=1 TO 949.
- COMPUTE grp=(id<825).
- END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.

FREQ VAR=grp.

COMPUTE draw=UNIFORM(1).
RANK VARIABLES=draw BY grp  /RANK INTO rdraw .
SELECT IF rdraw<41.
FREQ VAR=grp.