I need to create a new variable (var_1) that results in value 1 when all the other variables (var_2, var_3, var_4, var_5) have data available. Otherwise, if only one of them doesn't have any data it should show value 2.
So var_1 = 1 means that all data is available and var_1 = 2 means that not all data is available.
So I have written the following syntax in SPSS:
DO IF (var_2, var_3, var_4, var_5) GE 0.
COMPUTE var_1 = 1.
ELSE IF ANY (var_2, var_3, var_4, var_5) missing.
COMPUTE var_1 = 2.
END IF.
EXECUTE.
I don't know how to code "missing" and is giving me multiple error warnings. There may be a very easy solution for this but I'm really struggling anyway because I'm still a beginner, so any help will be much appreciated. Thank you!!
Aucun commentaire:
Enregistrer un commentaire