Commands

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Commands

alice temu
Dear all,

I am trying to figure out which command to apply in Transform-Compute-If (certain conditions apply) = 1, 2, 3....

Example1: Transform-Compute-If (price is between 110.50 & 150.30). The question is, what is the command for is between?

Whereby, Price is a continuous variable.

Thanks,
Alice.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Commands

Jignesh Sutar
You can use the RANGE function. Try,

COMPUTE newvar=RANGE(testvar,110.50,150.30).

Jigs

2009/1/6 alice temu <[hidden email]>

> Dear all,
>
> I am trying to figure out which command to apply in Transform-Compute-If
> (certain conditions apply) = 1, 2, 3....
>
> Example1: Transform-Compute-If (price is between 110.50 & 150.30). The
> question is, what is the command for is between?
>
> Whereby, Price is a continuous variable.
>
> Thanks,
> Alice.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (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
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Commands

alice temu
In reply to this post by alice temu
Dear ViAnn,
thanks for your help.
I forgot to mention that, in this case there are two different variables involeved.
That is why I thought I need the If condition in the menu interface.
Example: If  ((Buy = 0 & Price is between 10.99 and 20.99) OR (Buy = 1 & Price is between 9.99 and 19.99))
I think what you proposed is applied when I have one condition, sorry I forgot to mentioned it before. Any idea how I can proceed now?
Thanks again,
Alice.




________________________________
From: ViAnn Beadle <[hidden email]>
To: alice temu <[hidden email]>
Sent: Wednesday, January 7, 2009 9:09:47 AM
Subject: RE: Commands

Don't use the menu interface to do this because you need a do if construct.
Do Something like this:

DO IF x eq 1.
RECODE y (lowest thru 5 =1) (else =2) into newvar.
ELSE IF x eq 2.
RECODE y (lowest thru 6 =1) (else =2) into newvar.
END IF.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
alice temu
Sent: Wednesday, January 07, 2009 12:16 AM
To: [hidden email]
Subject: Commands

Dear all,

I am trying to figure out which command to apply in Transform-Compute-If
(certain conditions apply) = 1, 2, 3....

Example1: Transform-Compute-If (price is between 110.50 & 150.30). The
question is, what is the command for is between?

Whereby, Price is a continuous variable.

Thanks,
Alice.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Commands

Cleland, Patricia (EDU)
Alice

Try this. Not tested

If ((Buy = 0 & RANGE(Price, 10.99, 20.99)) OR (Buy = 1 & RANGE(Price,
9.99,19.99))) newvar=1.


Pat

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
alice temu
Sent: January 7, 2009 1:53 PM
To: [hidden email]
Subject: Re: Commands

Dear ViAnn,
thanks for your help.
I forgot to mention that, in this case there are two different variables
involeved.
That is why I thought I need the If condition in the menu interface.
Example: If  ((Buy = 0 & Price is between 10.99 and 20.99) OR (Buy = 1 &
Price is between 9.99 and 19.99))
I think what you proposed is applied when I have one condition, sorry I
forgot to mentioned it before. Any idea how I can proceed now?
Thanks again,
Alice.




________________________________
From: ViAnn Beadle <[hidden email]>
To: alice temu <[hidden email]>
Sent: Wednesday, January 7, 2009 9:09:47 AM
Subject: RE: Commands

Don't use the menu interface to do this because you need a do if
construct.
Do Something like this:

DO IF x eq 1.
RECODE y (lowest thru 5 =1) (else =2) into newvar.
ELSE IF x eq 2.
RECODE y (lowest thru 6 =1) (else =2) into newvar.
END IF.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
alice temu
Sent: Wednesday, January 07, 2009 12:16 AM
To: [hidden email]
Subject: Commands

Dear all,

I am trying to figure out which command to apply in Transform-Compute-If
(certain conditions apply) = 1, 2, 3....

Example1: Transform-Compute-If (price is between 110.50 & 150.30). The
question is, what is the command for is between?

Whereby, Price is a continuous variable.

Thanks,
Alice.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
[hidden email] (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
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Commands

alice temu
Dear Pat,

thanks a lot. I tested what you suggested. It works.

Good day,
Alice.




________________________________
From: "Cleland, Patricia (EDU)" <[hidden email]>
To: [hidden email]
Sent: Wednesday, January 7, 2009 2:06:50 PM
Subject: Re: Commands

Alice

Try this. Not tested

If ((Buy = 0 & RANGE(Price, 10.99, 20.99)) OR (Buy = 1 & RANGE(Price,
9.99,19.99))) newvar=1.


Pat

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
alice temu
Sent: January 7, 2009 1:53 PM
To: [hidden email]
Subject: Re: Commands

Dear ViAnn,
thanks for your help.
I forgot to mention that, in this case there are two different variables
involeved.
That is why I thought I need the If condition in the menu interface.
Example: If  ((Buy = 0 & Price is between 10.99 and 20.99) OR (Buy = 1 &
Price is between 9.99 and 19.99))
I think what you proposed is applied when I have one condition, sorry I
forgot to mentioned it before. Any idea how I can proceed now?
Thanks again,
Alice.




________________________________
From: ViAnn Beadle <[hidden email]>
To: alice temu <[hidden email]>
Sent: Wednesday, January 7, 2009 9:09:47 AM
Subject: RE: Commands

Don't use the menu interface to do this because you need a do if
construct.
Do Something like this:

DO IF x eq 1.
RECODE y (lowest thru 5 =1) (else =2) into newvar.
ELSE IF x eq 2.
RECODE y (lowest thru 6 =1) (else =2) into newvar.
END IF.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
alice temu
Sent: Wednesday, January 07, 2009 12:16 AM
To: [hidden email]
Subject: Commands

Dear all,

I am trying to figure out which command to apply in Transform-Compute-If
(certain conditions apply) = 1, 2, 3....

Example1: Transform-Compute-If (price is between 110.50 & 150.30). The
question is, what is the command for is between?

Whereby, Price is a continuous variable.

Thanks,
Alice.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
[hidden email] (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
[hidden email] (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
[hidden email] (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