In: Statistics and Probability
Given the following data set.
Name Homework Midterm Final
Frank 97 95 92
Emily 93 92 96
William 95 90 88
Janet 88 83 75
Betty 86 79 84
Joe 85 82 86
Bob 72 63 72
(a) Import the data into SAS and print it.
(b) Use SAS to create a new variable Total which is the weighted
average of all grades (the homework counts for 30% of the total
score, the midterm 25% and the final 45%). Add the variable to the
data frame.
(c) Use SAS to compute the mean and standard deviation of the
variables Homework, Midterm, Final and Total.
(d) Use SAS to make a scatterplot of the midterm scores against final scores.
Solution_A:
use data step to create table
input statement to describe variables
SAS CODE:
data exams;
infile cards;
input Name $ Homework Midterm Final;
cards;
Frank 97 95 92
Emily 93 92 96
William 95 90 88
Janet 88 83 75
Betty 86 79 84
Joe 85 82 86
Bob 72 63 72
;
run;
proc print data=exams;
run;
Output:
Solution-b:
SAS CODE:
data exams;
set exams;
Total=0.30*Homework+0.25*Midterm+0.45*final;
run;
proc print data=exams;
run;
Output:
Solution-c:
use proc means to print the mean and sd of variables
SAS Code:
proc means data=exams mean std;
var Homework Midterm Final Total;
run;
Output:
Solution-d:
use proc sgplot to get the scatterplot
SAS Code:
PROC SGPLOT DATA = exams;
scatter x=Midterm y=Final;
run;