Macro looping

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Macro looping

Jignesh Sutar
/***********************/.
dataset close all.
new file.
output close all.
get file='c:\program files\spssinc\statistics17\samples\english\employee data.sav'.

define !test (vars1=!charend('/') /vars2=!charend('/')).
freq !do !i !in (!vars1 & !vars2) !i !doend.
!enddefine.

set mprint on.
!test vars1=gender bdate /vars2=educ jobcat.
set mprint off.
/************************/.

Is there an alternative way to get the macro above to work?

I understand that the solution below is possible but I've simplifed it a little too much so it's not quite a solution for the problem I have at hand. The reason being that I actually have alot more code between each of the DO-DOEND's below so I would have to repeat all that for each DO-DOEND.

/************************/.
define !test (vars1=!charend('/') /vars2=!charend('/')).
freq !do !i !in (!vars1) !i !doend
      !do !i !in (!vars2) !i !doend.
!enddefine.

set mprint on.
!test vars1=gender bdate /vars2=educ jobcat.
set mprint off.
/************************/.

Thanks in advance.
Jignesh