Hi! I'm studying SAS, and I'm having trouble with this assignment (specifically Part C and D):
44. The official results of the 2012 London Olympics men’s 3-meter springboard diving finals can be found in the SAS data set called DIVING. The 2012 Olympic games were the first to use a new overall scoring method for diving. The data consist of six observations per diver, one for each of their six dives in the final event. The variables in this file are diver’s name, country, height (m), weight (kg), dive number (1 to 6), dive code, degree of difficulty, description, position, scores from each of seven judges, penalty, old scoring method, and new scoring method. Use only procedures to complete the following tasks.
a. Examine this SAS data set including the variable labels and attributes. Compute the overall mean, minimum, and maximum of the two scoring methods.
b. Calculate the total score per diver by summing the new scoring method scores for all dives. Output this information to a data set, sort, and then print it to determine which divers received the gold (highest total score), silver, and bronze medals for this event. Include a comment in your code stating the name of each medalist.
c. Count the numeric scores given to each diver by each judge according to the following judging criteria groupings: <0.5 = Completely Failed, 0.5 to <2.5 = Unsatisfactory, 2.5 to <5 = Deficient, 5 to <7 = Satisfactory, 7 to <8.5 = Good, 8.5 to <9.5 = Very Good, and 9.5+ = Excellent.
d. Calculate the minimum and maximum score per dive for each diver. Be sure to present your results by diver and in dive number order.
-
44. The official results of the 2012 London Olympics men’s 3-meter springboard diving finals can be found in the SAS data set called DIVING. The 2012 Olympic games were the first to use a new overall scoring method for diving. The data consist of six observations per diver, one for each of their six dives in the final event. The variables in this file are diver’s name, country, height (m), weight (kg), dive number (1 to 6), dive code, degree of difficulty, description, position, scores from each of seven judges, penalty, old scoring method, and new scoring method. Use only procedures to complete the following tasks.
a. Examine this SAS data set including the variable labels and attributes. Compute the overall mean, minimum, and maximum of the two scoring methods.
b. Calculate the total score per diver by summing the new scoring method scores for all dives. Output this information to a data set, sort, and then print it to determine which divers received the gold (highest total score), silver, and bronze medals for this event. Include a comment in your code stating the name of each medalist.
c. Count the numeric scores given to each diver by each judge according to the following judging criteria groupings: <0.5 = Completely Failed, 0.5 to <2.5 = Unsatisfactory, 2.5 to <5 = Deficient, 5 to <7 = Satisfactory, 7 to <8.5 = Good, 8.5 to <9.5 = Very Good, and 9.5+ = Excellent.
d. Calculate the minimum and maximum score per dive for each diver. Be sure to present your results by diver and in dive number order.
-
My main issues are the output for Part C (Which looks wide/messy), and Part D's Min and Max scores being the same, plus the sorting seems wrong (I think I'm misunderstanding what Part D is asking for, but it's sorted not by highest scores/medalist, but alphabetically by diver). It is due tonight, and I feel my code is just a mess, I'm very overwhelmed. SAS is starting to feel impossible for me.
My instructor says we are allowed to ignore the "use only procedures" portion, and can use DATA statements and PROC statements (including PROC SQL, which I have not used yet), but I've tried everything and any adjustments seem to make it worse.
How can I properly sort the data and calculate Min/Max values for part D if I've done it incorrectly?
Here is my code:
/* Step 1: LIBNAME statement to assign a library reference to Chapter 4's folder */
LIBNAME ch4lib "~/sasuser.v94/Chapter4";
/* Step 2: DATA and SET statements to copy the binary file contents to a working dataset */
DATA DIVING; SET ch4lib.DIVING; RUN;
/* Part A: PROC CONTENTS statement to examine the diving data set names, labels, and attributes */
PROC CONTENTS DATA = DIVING; RUN;
/* PROC TABULATE statement to compute and display the mean, minimum, and maximum for both scoring methods */
PROC TABULATE DATA = DIVING; VAR Score1 Score2; TABLE (Score1 Score2), (MEAN MIN MAX) * FORMAT = 8.2; TITLE "Mean, Minimum, and Maximum Scores (Old + New Scoring Methods)"; RUN;
/* Part B: PROC MEANS statement to calculate the total score per diver (w/ new scoring method)*/
PROC MEANS DATA = DIVING NOPRINT; CLASS Name; VAR Score2; OUTPUT OUT = DiverTotals SUM = TotalScore; RUN;
/* Sorting with PROC SORT statement, then printing the sorted totals (+ Top three medalists listed) */ PROC SORT DATA = DiverTotals; BY DESCENDING TotalScore; RUN;
PROC PRINT DATA = DiverTotals NOOBS; VAR Name TotalScore; TITLE "Total Points for Each Diver (New Scoring Method)"; RUN;
/* ---- Medalists ----
• Gold: ZAKHAROV Ilya
• Silver: QIN Kai
• Bronze: HE Chong ---- ---- */
/* Part C: PROC FORMAT statement to define judging categories */ PROC FORMAT; VALUE ScoreCat LOW - < 0.5 = 'Completely Failed' 0.5 - < 2.5 = 'Unsatisfactory' 2.5 - < 5 = 'Deficient' 5 - < 7 = 'Satisfactory' 7 - < 8.5 = 'Good' 8.5 - < 9.5 = 'Very Good' 9.5 - HIGH = 'Excellent'; RUN;
/* PROC TABULATE statement to sort and display the scores given by each judge for each diver */ PROC TABULATE DATA = DIVING; CLASS Name; CLASS J1 - J7; FORMAT J1 J2 J3 J4 J5 J6 J7 ScoreCat.; TABLE Name, (J1 J2 J3 J4 J5 J6 J7) * N = '' / BOX='Score Counts by Category' MISSTEXT = '0'; TITLE "Scores Given to Each Diver by Each Judge (Categorized)"; RUN;
/* Part 😧 PROC TABULATE statement to calculate and display the min/max score per dive for each diver */ PROC TABULATE DATA = DIVING; CLASS Name Dive; VAR Score2; TABLE Name * Dive, (Score2) * (MIN MAX) / BOX = 'Dive Score Range'; TITLE "Minimum and Maximum Scores per Dive"; RUN;