* "multiple Mann-Whitney tests.SPS" *(Q) I have a problem with a macro: DEFINE multi(depvar=!CHAREND ('/') /factor=!CHAREND ('/') /min=!CHAREND ('/') /max=!CMDEND ). DO IF $CASENUM=1. WRITE OUTFILE "c:\\temp\\multiman.sps" /"NPAR TESTS". LOOP #I=!min to !max-1. LOOP #J=#I+1 to !max. WRITE OUTFILE "c:\\temp\\multiman.sps" / " /M-W= !depvar BY !factor (" #I #J ")". END LOOP. END LOOP. WRITE OUTFILE "c:\\temp\\multiman.sps" /".". END IF. EXECUTE. INCLUDE FILE="c:\\temp\\multiman.sps". !ENDDEFINE. Its purpose is to perform multiple Mann-Whitney tests after a Kruskal-Wallis. As SPSS refuses to run statistical analyses inside any loop, I have tried to use loops to write a syntax file (multiman.sps) with the whole set of instructions and then run it with INCLUDE. * Example *. DATA LIST LIST /actype (F8.0) glucose (F8.0). BEGIN DATA 1 51 1 56 1 58 1 60 1 62 2 60 2 65 2 66 2 68 2 68 3 69 3 73 3 74 3 78 3 79 4 70 4 75 4 76 4 77 4 79 END DATA. multi depvar=glucose /factor=actype /min=1 /max=4. When I try to execute it, I get an error message saying that !depvar and !factor are recognized only inside a macro. So, the problem is: The "multiman.sps" file looks like this: NPAR TESTS /M-W= !depvar BY !factor ( 1.00 2.00) /M-W= !depvar BY !factor ( 1.00 3.00) /M-W= !depvar BY !factor ( 1.00 4.00) /M-W= !depvar BY !factor ( 2.00 3.00) /M-W= !depvar BY !factor ( 2.00 4.00) /M-W= !depvar BY !factor ( 3.00 4.00) . In order to make it work, I would like "multiman.sps" look like : NPAR TESTS /M-W= glucose BY actype ( 1.00 2.00) /M-W= glucose BY actype ( 1.00 3.00) /M-W= glucose BY actype ( 1.00 4.00) /M-W= glucose BY actype ( 2.00 3.00) /M-W= glucose BY actype ( 2.00 4.00) /M-W= glucose BY actype ( 3.00 4.00) . How can I write the variable names in multiman.sps? **************************************************. *(A) Posted by rlevesque@videotron.ca to SPSSX-L on 2002/01/03. **************************************************. SET MPRINT=no. *////////////////. DEFINE multi(depvar=!CHAREND('/') /factor=!CHAREND('/') /min=!CHAREND('/') /max=!CMDEND) STRING depvar factor(A8). COMPUTE depvar=!QUOTE(!depvar). COMPUTE factor=!QUOTE(!factor). DO IF $CASENUM=1. WRITE OUTFILE "c:\\temp\\multiman.sps" /"NPAR TESTS". LOOP #I=!min to !max-1. LOOP #J=#I+1 to !max. WRITE OUTFILE "c:\\temp\\multiman.sps" /" /M-W= "depvar" BY "factor" (" #I #J ")". END LOOP. END LOOP. WRITE OUTFILE "c:\\temp\\multiman.sps" /".". END IF. EXECUTE. INCLUDE FILE="c:\\temp\\multiman.sps". !ENDDEFINE. *////////////////. * Example *. DATA LIST LIST /actype (F8.0) glucose (F8.0). BEGIN DATA 1 51 1 56 1 58 1 60 1 62 2 60 2 65 2 66 2 68 2 68 3 69 3 73 3 74 3 78 3 79 4 70 4 75 4 76 4 77 4 79 END DATA. SET MPRINT=yes. multi depvar=glucose /factor=actype /min=1 /max=4.