LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 1997)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Jul 1997 09:38:19 -0500
Reply-To:     jon@spss.com
Sender:       "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From:         Jonathan Fry <jon@SPSS.COM>
Organization: SPSS Inc.
Subject:      Re: Repeat commands
Content-Type: text/plain; charset=us-ascii

DUCATI 750 SuperSport wrote: > > Hi, > > I have a set to variable rt1 to rt36. I like to subtract from every third > variable the precceding two, e.g. > > compute diff1 = rt3 - rt1. > compute diff2 = rt3 - rt2. > compute diff3 = rt6 - rt4. > compute diff4 = rt6 - rt5. > > I tried to use the loop - end loop command, but no avail. Does somebody know a > solution? Otherwise, I have to use the inelegant approach of typing all > substractions I need. > > met hartelijke groeten > > Jens Boelte > ------------------------------- > Psychologisches Institut II > Fliedner Str. 21 > 48149 Muenster > Germany

-- Assuming you have 36 rt variables which are consecutive in your file, and want 24 differences, you could use

vector rt (rt1 to rt36). vector diff (24) loop #i = 0 to 11. compute diff(2*#i+1) = rt(3*#i+3) - rt(3*#i+1). compute diff(2*#i+2) = rt(3*#i+3) - rt(3*#i+2). end loop. -------------------- Jonathan Fry SPSS Inc. jon@spss.com


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