Dear subscribers. I have a question regarding looping through variables.
I have created a syntax that computes statistics and outputs graphs to a PDF file. This syntax is run by an insert command as follows:
insert SYNTAX=INTERACTIVE FILE='H:\SPSS\IV.sps'. Before running the syntax I create some “macro variables” that are passed on to the syntax above.
define !BinnedVar () NSCORE !enddefine.
define !OrgVar () SCORE !enddefine.
define !OrgVarQuote () "SCORE" !enddefine.
Is it possible to loop through a list of variables and pass them on one by one to the syntax? I give an example below.
* Define the variables to loop through *.
Define !variables () var1 var2 var3 var4……. !enddefine.
* Start of the loop *.
define !BinnedVar () !CONCAT(‘N’,!variables) !enddefine.
define !OrgVar () !variables !enddefine.
define !OrgVarQuote () !QUOTES(!variables) !enddefine.
* Call the syntax *.
insert SYNTAX=INTERACTIVE FILE='H:\SPSS\IV.sps'. * End of the loop *.
I have tried to build the syntax as a macro but then I get error messages and the graphs are not outputted.
Regards, ───────────────────────────────────────────────────── |
Administrator
|
Maybe you should learn about MPRINT !DO, !EVAL and "real" macros (parameters??)! Also do you think posting the actual error messages might be a reasonable thing to do? Also, you would do well to describe WHAT you are actually intending to achieve ! Current 'design' is questionable at best! ---
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |