Missing values and DO IF
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * Working with missing values and DO IFs. * The Syntax Reference Guide states: *"Missing values returned by the logical expression on DO IF or on any ELSE IF cause control * to pass to the END IF command at that point." * rlevesque@videotron.ca. DATA LIST FREE /a. BEGIN DATA 1 . 1 . END DATA. COMPUTE b=a. * Thus the following code. DO IF a=1. COMPUTE a1=1. ELSE IF MISSING(a). COMPUTE a1=2. END IF. * does NOT work because when the result of a=1 is missing, the execution immediately jumps to the END IF line. * The second condition MISSING(a) is never tested. On the other hand the following works. DO IF MISSING(b). COMPUTE b1=2. ELSE IF b=1. COMPUTE b1=1. END IF. |
Related pages
...