Hi,
The following „macro_wo_loop“ brings "Z" to the screen, the other one („macro_loop“) with an additional loop around it presents "*" and some error messages I can't assign.
Is there a working way to call another macro inside a !do-!doend loop and pass an argument?
Best
Guido
--
output close all.
dataset close all.
new file.
DATA LIST LIST/ X Y Z (3 A1).
BEGIN DATA
F F A
R B B
END DATA.
save outfile = 'c:\temp\d.sav'.
dataset close all.
new file.
define macro1 (pop !tokens(1))
echo !quote(!pop).
!enddefine.
define macro_loop (v !tokens(1))
!do !i = 1 !to 1
get file = 'c:\temp\d.sav'.
do if $casenum = 1.
write outfile = 'c:\temp\foo.sps'
/'macro1 pop =' !quote(!v) '.'.
end if.
exe.
insert file = 'c:\temp\foo.sps'.
!doend
!enddefine.
define macro_wo_loop (v !tokens(1))
get file = 'c:\temp\d.sav'.
do if $casenum = 1.
write outfile = 'c:\temp\foo.sps'
/'macro1 pop =' !quote(!v) '.'.
end if.
exe.
insert file = 'c:\temp\foo.sps'.
!enddefine.
macro_wo_loop v = Z.
macro_loop v = Z.
| Free forum by Nabble | Edit this page |