Hi Winson,
Try this way:
GET FILE='C:\Program Files\SPSS14\GSS93 subset.sav'.
compute auxvar = $casenum.
define subsets().
!do !i = 1 !to 11
!let !num = !i
* padding !num with zeros.
!if (!length(!num) !lt 3) !then !let !num = !concat("0", !num) !ifend
!if (!length(!num) !lt 3) !then !let !num = !concat("0", !num) !ifend
!let !name = !quote(!concat("C:\Program Files\SPSS14\file",!num,".sav"))
temp.
select if auxvar >= !i and auxvar < !i + 40.
save outfile = !name /drop auxvar /compress.
!doend
!enddefine.
subsets.
HTH
Jan
-----Original Message-----
From: SPSSX(r) Discussion [mailto:
[hidden email]] On Behalf Of
Winson Yeung
Sent: Monday, October 16, 2006 9:17 AM
To:
[hidden email]
Subject: Break data file in SPSS
Dear all,
I want to break a SPSS data file with 1000 cases into small sessions of
40 consecutive cases each to run some models. That is, sessions for
case 1 - 40, case 2 - 41, case 3 - 42 and so on. Does anyone know how to
write syntax commands to break the data and save them into seperate
files? For example, file001.sav, file002.sav,..., etc.
Thanks & Regards,
Winson