|Date: ||Tue, 8 Jul 2008 17:55:36 -0400|
|Sender: ||"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>|
|Subject: ||Re: compute variable using if statements|
|Content-Type: ||text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed"|
Quoting Hector Maletta <firstname.lastname@example.org>:
> 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
> 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.
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
> 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:
> 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
For a list of commands to manage subscriptions, send the command