**** Question 1 ****;
if upcase(cvar) in ('A', 'B', 'C', 'D', 'E', 'F', 'G') then group=1;
else if upcase(cvar) in ('H', 'I', 'J', 'K', 'L', 'M', 'N') then group=2;
new_y = input(y, 7.3); *convert to numeric;
/* Calculate the average of X and Y by Group */
/* What is the average of X and Y for Group 2? */
proc means data=groups mean maxdec=2;
var x new_y;
What is the average of X for Group=2?
Answer: 47 (or 48)
What is the average of Y for Group=2?
**** Question 2 ****;
data class (keep=name sex height group);
length group $ 30;
if sex = "M" and height > 64 then Group="Above Average";
else if sex = "F" and height > 60 then Group="Above Average";
else Group="Below Average";
proc freq data=class;
There are 10 students whose height is above average and 9 students whose height is below average.