SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Rusty with Macro syntax

    Posted Fri November 10, 2023 11:29 AM

    I need to write a lot of lines of syntax and would like to use a macro for it. Can someone help?

    The syntax is really simple as shown below, but I need to run this for hundreds of variables that are just slightly different.

    One loop would be green highlighted looping from 1 to 136. Another is the yellow highlighted numbers in two vars need to loop from 1 to 10. I showed a number of rows of syntax to illustrate. I am pretty sure this is easy, I just don't remember how and don't have any of my old syntax from 10+ years ago :(

    if Q44_1_1_TEXT_1=1 AND Q44_1_1_1=1 Q44_1_1=1.

    if Q44_1_1_TEXT_1=2 AND Q44_1_1_1=1 Q44_2_1=1.

    if Q44_1_1_TEXT_1=3 AND Q44_1_1_1=1 Q44_3_1=1.

    ....

    if Q44_1_2_TEXT_1=1 AND Q44_1_2_1=1 Q44_1_1=1.

    if Q44_1_2_TEXT_1=2 AND Q44_1_2_1=1 Q44_2_1=1.

    if Q44_1_2_TEXT_1=3 AND Q44_1_2_1=1 Q44_3_1=1.

    ...

    if Q44_1_10_TEXT_1=136 AND Q44_1_10_1=1 Q44_136_1=1.



    ------------------------------
    Elinor Gaida
    ------------------------------