1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
* (Q) How can I split a data file in 2 separate random files.

* (A) Raynald@spsstools.net

GET FILE='C:\\Program Files\\SPSS\\Employee data.sav'.
COMPUTE draw=UNIFORM(1).
SORT CASES BY draw.

DO IF mod($CASENUM,2)=0.
- XSAVE OUTFILE='c:\\temp\\even cases.sav'.
ELSE.
- XSAVE OUTFILE='c:\\temp\\odd cases.sav'.
END IF.
EXECUTE.