LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 8 Jul 2008 15:13:14 -0300
Reply-To:   Hector Maletta <hmaletta@fibertel.com.ar>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Hector Maletta <hmaletta@fibertel.com.ar>
Subject:   Re: compute variable using if statements
Comments:   To: jimjohn <azam.khan@utoronto.ca>
In-Reply-To:   <18345270.post@talk.nabble.com>
Content-Type:   text/plain; charset="us-ascii"

You can enter two IF statements in syntax: IF (AGE LT 365) newvar=[formula 1] IF (AGE GE 365) newvar=[formula 2] You can also combine the two in a single formula with two logical conditions: COMPUTE newvar = (AGE LT 365) * [formula 1] + (AGE GE 365) * [formula 2]. In this variant, each logical condition will equal either 0 or 1, and therefore only one formula will be computed for each case.

Hector

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of jimjohn Sent: 08 July 2008 14:56 To: SPSSX-L@LISTSERV.UGA.EDU Subject: compute variable using if statements

guys sorry i know this is a basic question but i cant seem to remember how i did this last time. i have one variable, age in days, and another variable, rate. i want to create a formula for rate using values fo other variables. but i have a different formula for when age is < 365 and a different one when it is >= 365. In Compute Variable, there is an option for me to select an 'if statement'. But how do I enter in two if statements, with the different formulas for each. or is there a kind of syntax i can use? thanks so much! -- View this message in context: http://www.nabble.com/compute-variable-using-if-statements-tp18345270p183452 70.html Sent from the SPSSX Discussion mailing list archive at Nabble.com.

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (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

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (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


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