1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
*(Q) How can I multiply 2 macro variables.

*(A) By Ray 2002/04/18.
* http://pages.infinit.net/rlevesqu/index.htm.

DATA LIST LIST /a.
BEGIN DATA
1
END DATA.
LIST.

SET MPRINT=no.
DEFINE !mult (!POS=!TOKENS(1) /!POS=!TOKENS(1))
!LET !result=!NULL
!DO !cnt=1 !TO !1
!LET !result=!CONCAT(!result,!BLANK(!2))
!DOEND
COMPUTE res=!LENGTH(!result).
!ENDDEFINE.

SET MPRINT=yes.
!mult 3 4.
EXECUTE.