*(Q) I want to send a data variable as an argument to a macro. I want the macro to assign the valid values from the data variable to a macro variable. *Let's say I send V1 to my macro. V1 can take on the values of 243, 78, 432 or 8, so I want to assign those values to my macro variable and use it something like this: !DO !I !IN(!MACVAR) . iterate over the valid values from V1... !DOEND . *Is this possible? *(A) Posted to SPSS newsgroup on 2002/11/19 by Raynald Levesque. * The following code does the job. SET MPRINT=no. *////////////////////. DEFINE !getval(fpath=!TOKENS(1) /varn=!TOKENS(1)) GET FILE=!fpath. COMPUTE nobreak=1. AGGREGATE /OUTFILE=* /BREAK=!varn /nbval = N(nobreak). COMPUTE nobreak=1. MATCH FILES FILE=* /BY nobreak /LAST=last. DO IF $CASENUM=1. - WRITE OUTFILE='c:\\temp\\syntax.sps' /'DEFINE !macvar()'!varn. ELSE IF NOT last. - WRITE OUTFILE='c:\\temp\\syntax.sps' /' '!varn. ELSE. - WRITE OUTFILE='c:\\temp\\syntax.sps' /' '!varn'!ENDDEFINE.'. END IF. EXECUTE. GET FILE=!fpath. INCLUDE 'c:\\temp\\syntax.sps'. !ENDDEFINE. *////////////////////. SET MPRINT=yes. * Example 1. !getval fpath ='c:\\program files\\spss\\employee data.sav' varn =educ. * This is the content of the file syntax.sps. DEFINE !macvar() 8 12 14 15 16 17 18 19 20 21!ENDDEFINE.