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 |
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 |
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 |
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, -- Lori Andersen Ph.D. student, Educational Policy, Planning & Leadership College of William & Mary Williamsburg, VA |
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).
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?" |
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')
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?" |
Free forum by Nabble | Edit this page |