DATA MIXED; INPUT @20 TYPE $1. @; IF TYPE = '1' THEN INPUT ID 1-3 AGE 4-5 WEIGHT 6-8; ELSE IF TYPE = '2' THEN INPUT ID 1-3 AGE 10-11 WEIGHT 15-17; DATALINES; 003 23 220 2
The IF expression is false; thus the THEN clause is ignored. The normal flow of execution is to drop down and execute the next statement. The next statement is an ELSE statement. It begins execution of the statement enclosed in the ELSE clause. The IF expression inside the ELSE statement is evaluated. It is true so the THEN clause is executed. The normal flow of execution is to drop down and execute the next statement. The next statement is the DATALINES statement. The program data vector is written out to disk and the third execution of the data step ends.