syntax needed for equation

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

syntax needed for equation

msherman
Dear List: I have the following equation that I would like to write a syntax for. Advice appreciated.

P rep = [1 + (p/1-p)raised to 2/3] raised to -1

martin sherman


>>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<<
 -> .................... <-

Reply | Threaded
Open this post in threaded view
|

Re: syntax needed for equation

Richard Ristow
At 04:09 PM 10/15/2007, Martin Sherman wrote:

>I have the following equation that I would like to write a syntax for.
>
>P rep = [1 + (p/1-p)raised to 2/3] raised to -1


Do you mean

COMPUTE P_rep = (1 + (p/(1-p))**(2/3)**-1.

I've guessed that you mean "p/(1-p)" since "p/1-p", if evaluated
following the usual precedence rules, is 0.


>>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<<
 -> .................... <-

Reply | Threaded
Open this post in threaded view
|

Re: syntax needed for equation

ViAnn Beadle
In reply to this post by msherman
You don't say what you want to do with the computed results so I've stuck an
EXECUTE in here to force the data pass. My approach is to use the LEAVE
command which doesn't reinitialize a computed value as cases are read.

data list list / id dv1.
begin data
01        10
01        14
01        09
02        05
03        18
03        23
03        16
03         09
04         02
04         31
05         13
end data.
if sysmis(lag(id)) record=1 /* handle first case*/.
if lag(id) eq id record=record+1.
if lag(id) ne id record=1.
leave record.
execute.



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Martin Sherman
Sent: Monday, October 15, 2007 2:09 PM
To: [hidden email]
Subject: syntax needed for equation

Dear List: I have the following equation that I would like to write a syntax
for. Advice appreciated.

P rep = [1 + (p/1-p)raised to 2/3] raised to -1

martin sherman


>>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<<
 -> .................... <-


>>> Error in line 4 of spssx-l.mailtpl: unknown formatting command <<<
 -> .................... <-