missing values in the DO IFcommand

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

missing values in the DO IFcommand

Patricio Calderon-2
Hi,

I'm trying to create a new variable using the DO IF command and then COMPUTE
to create the new variable.  However, I'm stuck when I'm trying to define a
missing value. Here is an example:

DO IF (DT_EVENT_first EQ MISSING).
  COMPUTE CONTACTOK = 0.
ELSE IF (DT_EVENT_first EQ DT_EVENT_last).
  COMPUTE CONTACTOK = 1.
ELSE IF (DT_EVENT_first NE DT_EVENT_last).
  COMPUTE CONTACTOK = 2.
END IF.
EXECUTE.

Clearly the "MISSING" above is wrong. What do I have to write to indicate
that if a value is missing, the new variable should show a number zero.

Thank you for your help,
Patricio

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: missing values in the DO IFcommand

Rick Oliver-3
do if missing(dt_event_first)

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]
Phone: 312.893.4922 | T/L: 206-4922




From:        Patricio Calderon <[hidden email]>
To:        [hidden email]
Date:        04/11/2012 09:54 AM
Subject:        missing values in the DO IFcommand
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi,

I'm trying to create a new variable using the DO IF command and then COMPUTE
to create the new variable.  However, I'm stuck when I'm trying to define a
missing value. Here is an example:

DO IF (DT_EVENT_first EQ MISSING).
 COMPUTE CONTACTOK = 0.
ELSE IF (DT_EVENT_first EQ DT_EVENT_last).
 COMPUTE CONTACTOK = 1.
ELSE IF (DT_EVENT_first NE DT_EVENT_last).
 COMPUTE CONTACTOK = 2.
END IF.
EXECUTE.

Clearly the "MISSING" above is wrong. What do I have to write to indicate
that if a value is missing, the new variable should show a number zero.

Thank you for your help,
Patricio

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: missing values in the DO IFcommand

Patricio Calderon-2
In reply to this post by Patricio Calderon-2
Thank you Oliver, it worked.

Patricio

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: missing values in the DO IFcommand

lori.andersen
In reply to this post by Patricio Calderon-2
You need to know what value has been assigned as "Missing" maybe it is a period or a -999 or something.  What is the system missing value defined to be?

On Wed, Apr 11, 2012 at 11:13 AM, Patricio Calderon-2 [via SPSSX Discussion] <[hidden email]> wrote:
Hi,

I'm trying to create a new variable using the DO IF command and then COMPUTE
to create the new variable.  However, I'm stuck when I'm trying to define a
missing value. Here is an example:

DO IF (DT_EVENT_first EQ MISSING).
  COMPUTE CONTACTOK = 0.
ELSE IF (DT_EVENT_first EQ DT_EVENT_last).
  COMPUTE CONTACTOK = 1.
ELSE IF (DT_EVENT_first NE DT_EVENT_last).
  COMPUTE CONTACTOK = 2.
END IF.
EXECUTE.

Clearly the "MISSING" above is wrong. What do I have to write to indicate
that if a value is missing, the new variable should show a number zero.

Thank you for your help,
Patricio

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/missing-values-in-the-DO-IFcommand-tp5633148p5633148.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML



--
Lori Andersen
Ph.D. student, Educational Policy, Planning & Leadership
College of William & Mary
Williamsburg, VA


Reply | Threaded
Open this post in threaded view
|

Re: missing values in the DO IFcommand

David Marso
Administrator
In reply to this post by Patricio Calderon-2
Answer to question:
"What do I have to write to indicate that if a value is missing"
DO IF MISSING(T_EVENT_first).

OTOH:  I would simplify your approach to.
COMPUTE CONTACTOK =(DT_EVENT_first EQ DT_EVENT_last).
RECODE CONTACTOK (0=2)(1=1)(MISSING=0).
(And remove the EXECUTE command from any production code).
Patricio Calderon-2 wrote
Hi,

I'm trying to create a new variable using the DO IF command and then COMPUTE
to create the new variable.  However, I'm stuck when I'm trying to define a
missing value. Here is an example:

DO IF (DT_EVENT_first EQ MISSING).
  COMPUTE CONTACTOK = 0.
ELSE IF (DT_EVENT_first EQ DT_EVENT_last).
  COMPUTE CONTACTOK = 1.
ELSE IF (DT_EVENT_first NE DT_EVENT_last).
  COMPUTE CONTACTOK = 2.
END IF.
EXECUTE.

Clearly the "MISSING" above is wrong. What do I have to write to indicate
that if a value is missing, the new variable should show a number zero.

Thank you for your help,
Patricio

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: missing values in the DO IFcommand

David Marso
Administrator
In reply to this post by lori.andersen
"You need to know ...."
NOPE!!!
MISSING function works for either USER missing OR system missing.
"What is the system missing value defined to be?"
Odd question ;-))
That is platform specific and not in control of the user.  
One may determine it using SHOW SYSMIS but I can't fathom why anyone would really need to know aside from morbid curiosity.
*BUT there is no corresponding SET SYSMIS ;-)
--
SHOW SYSMIS.
On my Window system.
SYSMIS = -1.7976931+308  (X'FFEFFFFFFFFFFFFF')

lori.andersen wrote
You need to know what value has been assigned as "Missing" maybe it is a
period or a -999 or something.  What is the system missing value defined to
be?

On Wed, Apr 11, 2012 at 11:13 AM, Patricio Calderon-2 [via SPSSX
Discussion] <[hidden email]> wrote:

> Hi,
>
> I'm trying to create a new variable using the DO IF command and then
> COMPUTE
> to create the new variable.  However, I'm stuck when I'm trying to define
> a
> missing value. Here is an example:
>
> DO IF (DT_EVENT_first EQ MISSING).
>   COMPUTE CONTACTOK = 0.
> ELSE IF (DT_EVENT_first EQ DT_EVENT_last).
>   COMPUTE CONTACTOK = 1.
> ELSE IF (DT_EVENT_first NE DT_EVENT_last).
>   COMPUTE CONTACTOK = 2.
> END IF.
> EXECUTE.
>
> Clearly the "MISSING" above is wrong. What do I have to write to indicate
> that if a value is missing, the new variable should show a number zero.
>
> Thank you for your help,
> Patricio
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5633148&i=0>(not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://spssx-discussion.1045642.n5.nabble.com/missing-values-in-the-DO-IFcommand-tp5633148p5633148.html
>  To start a new topic under SPSSX Discussion, email
> [hidden email]
> To unsubscribe from SPSSX Discussion, click here<http://spssx-discussion.1045642.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1068821&code=bG9yaS5hbmRlcnNlbkBnbWFpbC5jb218MTA2ODgyMXwzMDQ5NjY2MjM=>
> .
> NAML<http://spssx-discussion.1045642.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



--
Lori Andersen
Ph.D. student, Educational Policy, Planning & Leadership
College of William & Mary
Williamsburg, VA
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"