IBM Support

What is the best way to use SYSMIS and / or MISSING function in a DO IF syntax command?

Question & Answer


Question

I do have a variable X in my file with some system missing values. I do want to create a new variable Y which is 1 when a case in X is value 0 and Y should be 2 for cases that are non equal zero in X. For system missing values I would like to have the value 99 in the new variable Y and would like to define it as user missing value. I tried it with the syntax below. However, when I look at the result the values of Y are all fine but not for the system missing values. They are still SYSMIS and not 99, why is this? DATA LIST / x (F2.0). BEGIN DATA 0 0 2 1 1 5 END DATA. EXECUTE. DO IF (X EQ 0). COMPUTE Y=1. ELSE IF (X NE 0). COMPUTE Y=2. ELSE IF SYSMIS(X). COMPUTE Y = 99. END IF. MISSING VALUES Y (99). EXECUTE.

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"20.0;19.0","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
16 June 2018

UID

swg21512391