1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
* A macro to delete a list of files.
* Posted to SPSSX-List by Raynald Levesque on 2004/02/11.

* Create some data files for illustration purposes.

DATA LIST LIST /a.
BEGIN DATA
1
END DATA.
SAVE OUTFILE='c:\\temp\\part1.sav'.
SAVE OUTFILE='c:\\temp\\part2.sav'.
SAVE OUTFILE='c:\\temp\\share table.sav'.
SAVE OUTFILE='c:\\temp\\part3.sav'.

* Define macro to delete some files.

DEFINE !dump (vlist = !ENCLOSE('(',')')).
!DO !z !IN (!vlist)
ERASE FILE = !QUOTE(!CONCAT("C:\\temp\\",!UNQUOTE(!z),".sav")).
!DOEND
!ENDDEFINE.

NEW FILE.
SET MPRINT=yes.
!dump VLIST (part1 part2 'share table' part3).
SET MPRINT=no.