The Full Example - 1
Follow through the code and make sure you understand what each part does. For the first line of data, the underlined code is executed.
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; 00134168 1
Since the IF expression is true, the THEN statement is executed. This causes execution of the INPUT statement. Since the IF expression is true, the ELSE statement is ignored. 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 first execution of the data step ends.