=========================================================================
Date: Fri, 21 Jul 2006 14:37:14 -0500
Reply-To: james.moffitt@thomson.com
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Jim Moffitt <james.moffitt@thomson.com>
Subject: Identify Users Syntax
Content-Type: text/plain; charset="us-ascii"
I need some syntax to create a numeric variable named BakerUser based on
3 non-contiguous variables. All 3 variables contain either a system
missing code or a 1 or a zero.
If all 3 non-contiguous variables are system missing then BakerUser
should be given a value of system missing.
If none of the 3 non-contiguous variables contain a 1 and one or
more of the 18 contiguous variables contain a 0 then BakerUser should be
given a value of 0.
If any of the 3 non-contiguous variables contain a value of 1 then
BakerUser should be given a value of 1.
I tried writing this syntax:
COMPUTE BakerUser=$sysmis.
EXECUTE.
IF(q4a23=1 or q4a29=1 or q4a32=1) BakerUser=1.
EXECUTE.
FORMAT BakerUser (f1.0).
IF(q4a23~=1 and q4a29~=1 and q4a32~=1) AND IF (q4a23=0 or q4a29=0 or
q4a32=0) BakerUser=0.
EXECUTE.
It crashes on the IF command with the following error message:
Error#4023 in column 44. Text: IF
An expression contains a string of characters followed by a left
parenthesis, indicating that the string of characters is a function or
vector name, but the characters do not match any existing function or
vector. Check the spelling.
This command not executed.
Any suggestions?
I also need some syntax to create a numeric variable named AcmeUser
based on the values of 18 contiguous variables named q4a1 to q4a18. All
18 variables are either system missing or they contain either a 1 or a
zero.
If all 18 contiguous variables are system missing then AcmeUser
should be given a value of system missing.
If none of the 18 contiguous variables contain a 1 and one or more
of the 18 contiguous variables contain a 0 then AcmeUser should be given
a value of 0.
If any of 18 contiguous variables contain a value of 1 then AcmeUser
should be given a value of 1.
How would I write syntax similar to that noted above where the original
variables are contiguous without having to list all eighteen variables.
Thanks for your help.
|