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
27
28
29
30
31
32
* From spss usenet; by Bjarte Aagnes 99/11/14.

set mprint=on.
*some data.
DATA LIST FREE /v1.
BEGIN DATA
142 132 13 134 2 6 3 6 1 1 23 345 34
END DATA.

RANK v1 /n into N.
* N contains the number of cases in the file.
* make a submacro to be invoked from the main macro.

DO IF $CASENUM=1.
WRITE OUTFILE 'c:\\temp\\temp.sps' /"DEFINE !subN()"/n/"!ENDDEFINE.".
END IF.
EXE.

INCL FILE="c:\\temp\\temp.sps".
/* The number of cases in the file is now accessible using !subN */.

*define main macro.
DEFINE !MAIN()
COMPUTE NewN=!subN*2.
EXE.
!ENDDEFINE.

*run main macro.

!MAIN.

***************************************************.