Exercise (2-2)


The program code below is intended to:

  • Create a new variable called GROUP based on the following logic:
    • Group = "Above Average" for male students above 64 inches and female students above 60 inches
    • Group = "Below Average" for other students
  • Assign the length of Group to be 30
  • Keep only the NAME, SEX, HEIGHT and GROUP columns in the output data set.
data class (keep name sex height group);
set sashelp.class;
if sex = "M" and height > 64 then Group="Above Average";
if sex = "F" and height > 60 then Group="Above Average";
else Group="Below Average";

length group 30;


Correct the program and calculate how many students are in each group.