Previous PageNext Page

From Example 10 in Chapter 1
Recall example 10

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;

The way to achieve the same end with SELECT-WHEN is as follows:

DATA MIXED;
   INPUT @20 TYPE 1. @;
   SELECT (TYPE); 
      WHEN (1) INPUT ID     1-3
                     AGE    4-5
                     WEIGHT 6-8;
      WHEN (2) INPUT ID     1-3
                     AGE    10-11
                     WEIGHT 15-17;
      OTHERWISE PUT TYPE=;
   END;
DATALINES;

Previous PageTable Of ContentsNext Page