1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
*(Q) How can I split a file into 10 random pieces of equal size.

*(A) Posted to SPSSX-L list by Raynald Levesque on 2002/07/30.
* www.spssstools.net
*.

GET FILE='C:\\Program Files\\SPSS2\\Employee data.sav'.
COMPUTE draw=UNIFORM(1).
COMPUTE nobreak=1.
RANK  VARIABLES=draw  (A) BY nobreak  /NTILES (10).
* Check that it works.
FREQ VAR=ndraw.

(Of course if the number of cases is not a multiple of 10, some groups will
have 1 more cases than others).