Re: compute + do if commands

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: compute + do if commands

Norton, John
Hi Ismail,

It looks like you are missing command terminators (periods) after your compute statements. Also, be sure that the "howoldareyou" variable is string if you'll be encapsulating the values within quotes.

HTH

John Norton
SPSS Inc.


From: SPSSX(r) Discussion <[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Sun May 31 13:38:41 2009
Subject: compute + do if commands

Can some one tell me what is wrong with this syntax? Every time and run it it SPSS give me an error that reads like this:

>Error # 4305 in column 1.  Text: COMPUTE
>A relational operator may have two numeric operands or two character string
>operands.  To compare a character string to a numeric quantity, consider using
>the STRING or NUMBER function.
>This command not executed.
Do IF howoldareyou='4'
Compute weightage=0/3.

This is the Syntax........

DATASET ACTIVATE DataSet3.
COMPUTE weightage=15/8.
Do IF howoldareyou='1'
COMPUTE weightage=26/19.
Do IF howoldareyou='2'
COMPUTE weightage=32/40.
Do IF howoldareyou='3'
COMPUTE weightage=26/31.
Do IF howoldareyou='4'
Compute weightage=0/3.
Do IF howoldareyou='5'
End If.
EXECUTE .

Thanks.........

Ismail K. Noor, Ph.D.,
[hidden email]
http://www.dennonoor.com
(313) 690-0755 (cell)