pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting DO IF command error


From: Jill Covert
Subject: Re: getting DO IF command error
Date: Tue, 10 Apr 2012 08:12:31 -0700

Thank you so much--that helps a lot.

On Mon, Apr 9, 2012 at 11:47 PM, John Darrington <address@hidden> wrote:
I think there are two things you need to note:

1. Whenever you assign a variable, you need to use the COMPUTE keyword.  ie: COMPUTE x = 3.
  and not simply x = 3 (which pspp will consider to be a boolean _expression_, whose result
  depends on whether x has the value 3).

2. SYSMIS (when used in syntax) is function , not a constant.  However $SYSMIS is a constant.

If you look up SYSMIS in the index of the user manual, you should find this explained.

So try something like this:

DO IF CoeMis=0 or CoeMis=1 or CoeMis=2.
COMPUTE MeanCoe2 = SUM(OE15, OE16, OE17, OE18, OE19, OE20, OE21)/(7-CoeMis).
ELSE
COMPUTE MeanCoe2 = $SYSMIS.
END IF.

Alternatively, you could use the RECODE command.

I hope this helps.


On Mon, Apr 09, 2012 at 03:52:58PM -0700, Jill Covert wrote:
    Hi,

    I've tried the following DO IF commands without success (I'm able to run
    the means correctly, but do not get a sysmis for those where CoeMis is > 2):

    DO IF CoeMis=0 or CoeMis=1 or CoeMis=2.
    COMPUTE MeanCoe2 = SUM(OE15, OE16, OE17, OE18, OE19, OE20, OE21)/(7-CoeMis).
    ELSE MeanCoe2=sysmis.
    END IF.
    DO IF CoeMis=0 or CoeMis=1 or CoeMis=2.
    COMPUTE MeanCoe2 = SUM(OE15, OE16, OE17, OE18, OE19, OE20, OE21)/(7-CoeMis).
    ELSE IF CoeMis>2 MeanCoe2=sysmis.
    END IF.

    DO IF CoeMis=0 or CoeMis=1 or CoeMis=2.
    COMPUTE MeanCoe2 = SUM(OE15, OE16, OE17, OE18, OE19, OE20, OE21)/(7-CoeMis).
    ELSE CoeMis>2 MeanCoe2=sysmis.
    END IF.

    DO IF CoeMis=0 or CoeMis=1 or CoeMis=2.
    COMPUTE MeanCoe2 = SUM(OE15, OE16, OE17, OE18, OE19, OE20, OE21)/(7-CoeMis).
    ELSE MeanCoe2 (sysmis).
    END IF.

    Error message in Output for the first attempt--others are
    similar--expecting end of command at MeanCoe2:
    DO IF CoeMis = 0 or CoeMis=1 or CoeMis=2.
    COMPUTE  MeanCoe2 = SUM(OE15, OE16, OE17, OE18, OE19, OE20,
    OE21)/(7-CoeMis).
    R:\EVALUA~1\CBOEXC~1\Data\Syntax\TP-OE.sps.6-13: error: ELSE: Syntax error
    at
    `MeanCoe2': expecting end of command.
    ELSE MeanCoe2=sysmis.
    END IF.

    I also wasn't able to simply write:
    DO IF CoeMis < 3.
    but at least got it to work writing out each number.

    If anyone can point out my error, I would much appreciate it! And if you
    need more info, please let me know.

    Thank you!
    Jill

    *We know how to organize warfare, but do we know how to act when confronted
    with peace?

    *
        -- Jacques-Yves Cousteau (1910-1997)

    _______________________________________________
    Pspp-users mailing list
    address@hidden
    https://lists.gnu.org/mailman/listinfo/pspp-users


--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFPg9dlimdxnC3oJ7MRAq0QAJ9OR0yuI5A1tdhuut5ziq0nKaKjRACeK3+H
CFlADwvEbA6wR9byOMKiD2k=
=JGJf
-----END PGP SIGNATURE-----




--
________________________
 
Jill Covert, MA
Peace & Justice Studies
Researcher & Evaluator
Tel: 619-928-8427
Email: address@hidden
 
 
We know how to organize warfare, but do we know how to act when confronted with peace?

    -- Jacques-Yves Cousteau (1910-1997)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]