Date: Tue, 8 Jul 2008 17:55:36 -0400 azam.khan@utoronto.ca "SPSSX(r) Discussion" azam.khan@utoronto.ca Re: compute variable using if statements To: Hector Maletta <011401c8e126\$5af54750\$9c00a8c0@NOTEBOOK> text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed"

Thanks!

Quoting Hector Maletta <hmaletta@fibertel.com.ar>:

> 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