[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting DO IF command error
From: |
John Darrington |
Subject: |
Re: getting DO IF command error |
Date: |
Tue, 10 Apr 2012 06:47:02 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
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.
signature.asc
Description: Digital signature