mirirai
mirirai

Reputation: 1439

How to set a variable to SYSMIS in SPSS depending on an IF-Condition

Lets say for example I have a variable in SPSS named var1 containing ones and zeros. And I have another variable var2 which I want to set to sysmis if var1 = 1.

How can I do that in SPSS?

The line

IF (var1=1) var2 = SYSMIS.

produces an error.

Upvotes: 1

Views: 1780

Answers (1)

mirirai
mirirai

Reputation: 1439

The trick here is to use the system variable $SYSMIS.

IF (var1=1) var2 = $SYSMIS.

$SYSMIS is documented in Variables section under Universals section in the Syntax Reference Guide.

Upvotes: 1

Related Questions