0
$\begingroup$

I want to split my data set into two files, 50% of random cases in each file. I would like to use the first set as a training set and the second one for testing my prediction model.

Following is an example: 10 cases (1,2,3,4,5,6,7,8,9,10), I want to split it into 2 files with 5 random cases in each file (1,3,6,7,9) and (2,4,5,8,10).

How can I do this using Data>Select Cases option? I am able to generate a single set of 50% random cases but how do I test the remaining 50% of cases. SPSS gives an output of only 1 file

$\endgroup$
  • $\begingroup$ This Q is both off-topic and also unclear (for example, may the two subsamples intersect by their case composition or not?). $\endgroup$ – ttnphns Feb 18 '16 at 19:00
1
$\begingroup$

Data -> Select Cases. Choose "Random sample of cases". You can either specify approximately 50% of the cases (SPSS Syntax below) or a specific number. You should tick the option in the Output box to "Copy selected cases to a new dataset" and name the new dataset (this is also in the syntax below).

DATASET ACTIVATE DataSet1.
DATASET COPY  dataset2.
DATASET ACTIVATE  dataset2.
FILTER OFF.
USE ALL.
SAMPLE  .50.
EXECUTE.
DATASET ACTIVATE  DataSet1.
| cite | improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.