16 Handbook of SAS
®
DATA Step Programming
The last SELECT group creates the variable HIGHINCOME. In this
SELECT group, no select-expression is specied. In this situation, the when-
expression is evaluated for selecting which WHEN statement is to be
executed.
Program 2.12:
data hearing2_9;
set hearing;
length ethnic $ 10;
select (race);
when ("W", "H") ethnic = "white";
when ("B", "A") ethnic = "non-white";
end;
select (preg);
when (1) do;
trial = "A";
drug = "Treatment";
end;
when (0) do;
trial = "B";
drug = "placebo";
end;
otherwise;
end;
select(hearing);
when ("yes") group = 1;
when ("no") group = 2;
otherwise group = 3;
end;
select;
when (income > 100000) highincome = 1;
when (income >.) highincome = 0;
otherwise;
end;
run ...