Search code examples
variablessystemmissing-dataspss

system missings when computing variable


I'm trying to compute a new variable using 3 other variables. If all 3 conditions are positive, the new variable gives 1. My problem: if just 1 or 2 of these conditions are present, I get a value 0 when it needs to be a system missing.


Solution

  • In order to get SPSS to calculate a value only when you have values in all three variables you can use this:

    if nmiss(E’sept_preTx, Eope’gem_preTx, TRpieksnelheid_t1)=0
     DD_new=(E’sept_preTx < 10) & (Eope’gem_preTx >= 15) & (TRpieksnelheid_t1 > 2.8). 
    

    the nmiss counts the missing values, and the original calculation is carried out only if tere are none.