So I am trying to create a status variable. It looks like this
IF [Age] > 18 AND [Sex] = 'Female' AND [Parch] > 0 AND [Salutation] != "Miss."
THEN "Mother"
Else
IF [Age] > 18 AND [Sex] = 'Male' AND [Parch] = 0 AND [SibSp] =0
THEN "SingleMan"
Else
IF [Age] >=12 AND [Parch] >0
THEN "Child"
ELSE "Regular"
ENDIF
But as you can see, that doesnt seem to work. Any ideas how to make it functionable ?
Solved! Go to Solution.
IF [Age] > 18 AND [Sex] = 'Female' AND [Parch] > 0 AND [Salutation] != "Miss."
THEN "Mother"
ElseIf
[Age] > 18 AND [Sex] = 'Male' AND [Parch] = 0 AND [SibSp] =0
THEN "SingleMan"
ElseIf
[Age] >=12 AND [Parch] >0
THEN "Child"
ELSE "Regular"
ENDIF
Helpful As always! Thank you!
To add to @MarqueeCrew:
When you put a space between ELSE and IF, you are initiating another IF statement: a nested IF.
IF [this]
THEN 'that'
ELSE IF [this other thing] THEN 'that other thing' ELSE 'done' ENDIF
ENDIF
ELSEIF just adds another condition to your IF statement.
IF [this]
THEN 'that'
ELSEIF [this other thing]
THEN 'that other thing'
ELSE 'nothing'
ENDIF
Both of these are syntactically valid but they are used for different reasons.