|
I have a piece of syntax that repeats for multiple variables (see
examples of two variables below). Ns are sample size; Vs are scores on a test. I've just learned about macros and python, but I can't find anything that would work. I appreciate any help. Thanks! DO IF (N1 < 100). RECODE V1 (0 thru 1=SYSMIS). END IF. DO IF (N2 < 100). RECODE V2 (0 thru 1=SYSMIS). END IF. ##################################################################################### This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto. ##################################################################################### ====================To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Untested,
I would stay away from Macro if i were you though, in the long run python is far more useful to put your time into. Not knowing your structure, but i would create a begin program. import spss, spssaux, viewer sample_size = [2,4,5,6,6,8] Scores = [20,30,40,150,80,300] for i in sample_size: test =""" DO IF (%i < 100). RECODE %i (0 thru 1=SYSMIS). END IF.""" %(i,scores[i]) spss.Submit(test) This is untested, however you could streamline this code even more by dynamically filling the sample size and scores in. Mike On Tue, Aug 19, 2008 at 2:20 PM, Carolyn Catenhauser < [hidden email]> wrote: > I have a piece of syntax that repeats for multiple variables (see > examples of two variables below). Ns are sample size; Vs are scores on a > test. I've just learned about macros and python, but I can't find > anything that would work. I appreciate any help. Thanks! > > > > DO IF (N1 < 100). > > RECODE > > V1 (0 thru 1=SYSMIS). > > END IF. > > > > DO IF (N2 < 100). > > RECODE > > V2 (0 thru 1=SYSMIS). > > END IF. > > > > > > > > > > > > > > ##################################################################################### > This email and any attachments thereto may contain private, confidential, > and privileged material for the sole use of the intended recipient. Any > review, > copying, or distribution of this email (or any attachments thereto) by > others is > strictly prohibited. If you are not the intended recipient, please contact > the sender > immediately and permanently delete the original and any copies of this > email and any > attachments thereto. > > ##################################################################################### > > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except the > command. To leave the list, send the command > SIGNOFF SPSSX-L > For a list of commands to manage subscriptions, send the command > INFO REFCARD > -- Michael Pearmain Senior Statistical Analyst Google UK Ltd Belgrave House 76 Buckingham Palace Road London SW1W 9TQ United Kingdom t +44 (0) 2032191684 [hidden email] "If you received this communication by mistake, please don't forward it to anyone else (it may contain confidential or privileged information), please erase all copies of it, including all attachments, and please let the sender know it went to the wrong person. Thanks." ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
In reply to this post by Carolyn Catenhauser
Carolyn,
Another way to do this is by using a do repeat structure. Like this. Do repeat x=n1 n2 ... Nn/y=v1 v2 ... Vn. + DO IF (x < 100). + RECODE y (0 thru 1=SYSMIS). + END IF. End repeat. Gene Maguin ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
