Date: Thu, 31 Oct 2002 13:16:42 -0600
Reply-To: "Marks, Jim" <jim.marks@lodgenet.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Marks, Jim" <jim.marks@lodgenet.com>
Subject: Re: Why does (missing value) multiplied by zero = zero?
Content-Type: text/plain; charset="iso-8859-1"
Does this help?
** original data-- one case changed to q = 9999 and type = 1.
DATA LIST LIST /TYPE Q.
BEGIN DATA
1 25
1 2
1 0
1 9999
1 17
2 9999
2 26
2 9999
2 0
2 18
END DATA.
LIST.
MISSING VALUES Q (9999).
** new syntax.
COMPUTE qa = q.
DO IF type = 1.
RECODE qa (SYSMIS = -9).
ELSE.
RECODE qa (ELSE = SYSMIS).
END IF.
COMPUTE qb = q.
DO IF type = 2.
RECODE qb (SYSMIS = -9).
ELSE.
RECODE qb (ELSE = SYSMIS).
END IF.
LIST.
HTH
Jim Marks
Senior Market Analyst
LodgeNet Entertainment Corporation
605.988.1616
IMPORTANT NOTICE: This communication (including any attached files) is
intended for the entity to which it is directed and may contain confidential
and proprietary information of LodgeNet Entertainment Corporation. The
communication is provided under the terms of the nondisclosure agreement
between LodgeNet and the intended recipient. If you are not acting solely
on behalf of the intended recipient with respect to the receipt of this
communication, you are not authorized to receive, retain, print or forward
this communication. In that event, you are directed to destroy this
communication (including any attached files), and to advise
ipmanager@lodgenet.com that you received this communication in error. If
you are authorized to receive this communication on behalf of the intended
recipient, you are obligated to treat it as confidential and proprietary
information of LodgeNet Entertainment Corporation, in accordance with the
nondisclosure agreement mentioned above.
-----Original Message-----
From: Andrew Fenyo [mailto:A.J.Fenyo@ukc.ac.uk]
Sent: Thursday, October 31, 2002 11:27 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Why does (missing value) multiplied by zero = zero?
Folks,
I have been tearing my hair out, but I cannot see what I am doing wrong!
I have a variable Q and a category TYPE. I need to create two new
variables (QA and QB) which take the value of Q or MISSING depending
on TYPE. It works fine EXCEPT when Q is zero: then I get both QA and QB set
to zero.
I have probably overlooked something very simple, but any suggestions would
be most welcome.
Here is a sample and the syntax:
DATA LIST LIST /TYPE Q.
BEGIN DATA
1 25
1 2
1 0
1 6
1 17
2 6
2 26
2 9999
2 0
2 18
END DATA.
LIST.
MISSING VALUES Q (9999).
COMPUTE ATYPE=2-TYPE.
COMPUTE BTYPE=1-ATYPE.
MISSING VALUES ATYPE BTYPE (0).
LIST.
DO IF MISSING (Q).
COMPUTE QA=-9.
COMPUTE QB=-9.
ELSE.
COMPUTE QA=Q*ATYPE.
COMPUTE QB=Q*BTYPE.
END IF.
MISSING VALUES QA QB (-9).
LIST.
==============================
Andrew Fenyo, Senior Computing Officer
Personal Social Services Research Unit
University of Kent, Canterbury, CT2 7NF
Voice: 01227 827610 Fax: 01227 827038
PSSRU: http://www.ukc.ac.uk/PSSRU