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
33
34
35
36
*(Q) The following macro was posted (without the 4 lines of macro command 
	at the beginning of the macro). The author was looking for a way to 
	insert commas between the names of the variables given as input to
	the macro. 

*(A) Posted to SPSSX-L on 2002/4/11 by Ray.
* Web site www.spsstools.net .

SET MPRINT=no.
define impute (!positional !enclose ('(',')') 
	/ !positional !enclose('(',')') 
	/ !positional !enclose ('(',')'))

!LET !varlist=!HEAD(!1)
!DO !var !IN (!TAIL(!1))
!LET !varlist=!CONCAT(!varlist,',',!var)
!DOEND

COUNT  #mitems = !1  (MISSING).
COUNT  #items  = !1  (lo thru hi).
compute #diff = 1 - (#mitems / #items).
DO IF (#diff LT .75).
compute #FILL = MEAN(!varlist).
END IF.
DO REPEAT x = !1.
if missing(x) x = #fill.
END REPEAT.
compute scale1 = SUM(!varlist ).
EXECUTE .

!enddefine.
******************************************************************.

SET MPRINT=yes.
* call the macro.
impute (q2a q2b q2c).