```Date: Fri, 18 Aug 2006 13:20:32 -0700 Reply-To: Albert-jan Roskam Sender: "SPSSX(r) Discussion" From: Albert-jan Roskam Subject: Re: Loop and macro help Comments: To: Laura Leach In-Reply-To: <200608181505.k7IF53WF002202@mailgw.cc.uga.edu> Content-Type: text/plain; charset=iso-8859-1 Hi Laura, Below is something you could try. I had a hard time understanding what exactly you wanted to do. Since you've made some syntax already, you could compare the outcome of my syntax with the one you made yourself. You should really make that comparison, as I am REALLY not sure about this solution (maybe it's the wine I drank earlier *hick-up* ;-)) Btw, please be aware that COUNT counts the events (e.g. '5 thru 6'). This means that 'non-events' are in this example '1' BUT ALSO missing values! This is something which yours truly discovered much too late. ;-) loop #i = 1 to 90. loop #j = 1 to 5. do if (qA4=#i and qC1=#j) . count Base1E1_FAV = qE1a qE1b qE1c (5 thru 6) . count Base1E1_TOL = qE1a qE1b qE1c (1 thru 6) . end if. end loop. end loop. compute Base1E1_DEL = (Base1E1_FAV / Base1E1_TOL) - AFFav. exe. Cheers! Albert-Jan --- Laura Leach wrote: > Hi, Below is the syntax that I am trying to automate > because it needs to be > done several hundred times. I am new to SPSS and > feel like I am currently > killing an ant with a slede-hammer by doing this by > hand. The entire point > of this syntax is to get the value of "Base1E1_DEL" > for every case. But to > arrive at that, in the DO IF, "qA4=1" is related to > the variable > label "Base1" (i.e., qA4=10 label equals Base10, > etc.) and the "qC1=1" is > related to the "E1" part of the label (no systematic > link because label > part is alphanumeric). These two variables qA4 and > qC1 do not change in a > systematic way (i.e., they are not 1,2,3,4, etc.). > What I have been doing > is copying and pasting this piece of syntax for > every single iteration. > (qA4 has 90 different values, and qC1 has 5 > different values). Is there a > way to streamline this to change the values of > qA4/qC1 and it's > corresponding new variable label, or even better > yet, is there a way to > arrive at the _DEL vairable without creating 4 new > variables to get there? > > Thanks for any help!! > Laura > > > > > DO IF (qA4=1 AND qC1=1) . > COUNT Base1E1_FAV = qE1a qE1b qE1c (5 thru 6) . > END IF . > EXECUTE . > > DO IF (qA4=1 AND qC1=1). > COUNT Base1E1_TOL = qE1a qE1b qE1c (1 thru 6) . > END IF. > EXECUTE . > > COMPUTE Base1E1_PFAV = Base1E1_FAV / Base1E1_TOL . > EXECUTE . > > COMPUTE Base1E1_DEL = Base1E1_PFAV-AFFav. > EXECUTE . > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ```

Back to: Top of message | Previous page | Main SPSSX-L page