Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need the answer in SAS code. Thank you! (a) (2pts) Use list input to create a te

ID: 2949276 • Letter: N

Question

Need the answer in SAS code. Thank you!

(a) (2pts) Use list input to create a temporary dataset called grades by reading the following in-stream data (Table 2). The representation of variable is listed in Table 3 Table 2: Grades Name Ger HW Midl Mid2 Pro Justin Male 90 88 75 82 Christal Female 100 858088 Rebecca Female 80 77765 90 Jacob Male 6067 53 70 CindyFeale 8583 6890 Easton Male 76 7:3 Table 3: Descriptions of Variables Variable Name DescriptionsVariable Type Name Gender HW Midl Mid2 Student Name Character Gender Homework Midterml Midterm2 Project Character Numeric Numeric Numeric Numeric To (b)(1pt) Create a new variable Avg using assignment statement, which is the average of the two midterms. If one of the two midterms is missing, I expe missing value ct the average is also marked as (c)(4pts) Create a new variable Final according to the following rule Final 30%Homework + 20%Midterm 1 + 20%Midterm2 + 30%Project If Midterm1 is a missing value, then the final score is defined to be Final 30% Homework + 40% Midterm2 + 30% Project (d)(1pt) Round the Final to the nearest integer and save it as a new variable Intfinal. (e)(2pts) Print the entire dataset, including all the newly created variables. When printing, use LABLE statement to assign labels to variables HW, Mid1, Mid2, Pro to make your output more readable. Particularly, use the descriptions in Table 3 as the labels. Use labels rather than the variable names when printing the dataset

Explanation / Answer

All the SAS code will be indented ( space left on the left margin), and the explanation and comments will be non-indented.

a.

We have to create a temporary dataset, called grades, by reading in all these values. The SAS code to do this would be:

DATA grades;

input Name $ Gender $ HW Mid1 Mid2 Pro;

datalines;

Justin Male 90 88 75 82

Christal Female 100 85 80 88

Rebecca Female 80 77 71 65

Easton Male 90 . 76 73

Jacob Male 60 67 53 70

Cindy Female 85 83 68 90

;

b.

We have to create a new variable, 'Avg' which would be the average of the two mid terms. This variable should display a '.' if any of the values is missing. The SAS code continuation of question a. would be:

DATA grades;

set grades;

Avg= (Mid1+Mid2)/2 ;

c.

We have to create a new variable, 'Final', which would be the weighted sum of all the scores (midterm1, midterm2, homework and project). If the midterm1 value is missing, we must use a different weighted sum. The SAS code continuation of question b. would be:

DATA grades;

set grades;

Final= 0.3*HW+0.2*Mid1+0.2*Mid2+0.3*Pro;

if Mid1=. then do;

Final= 0.3*HW+0.4*Mid2+0.3*Pro;

end;

d.

We have to round off the 'Final' score and add it as a new column called 'Intfinal' by converting the rounded off number to integer. The SAS code continuation of question c. would be:

DATA grades;

set grades;

Intfinal= int(round(Final));

e.

Finally, we have to print this table by renaming the columns using 'label'. The SAS continuation of question d. would be:

PROC PRINT data=grades label;

label Name="Student Name"

HW="Homework"

Mid1="Midterm1"

Mid2="Midterm2"

Pro="Project"

;

Please feel free to comment below if you have any doubt/ need any clarification. Happy learning!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote