*(a) 5 points; data tennis; * read in the data; filename ten url 'http://www.stat.ncsu.edu/people/rasathurai/courses/ST445/tennis.txt'; infile ten; input first_name $ last_name $ major_match_wins major_match_losses overall_match_wins overall_match_losses major_titles overall_titles; run; *(b) 3 points; data tennis1; set tennis; * add two more variables; major_winning_pct = major_match_wins/(major_match_wins+major_match_losses); overall_winning_pct = overall_match_wins/(overall_match_wins+overall_match_losses); run; proc sort data=tennis1; * sort the data by major_winning_pct; by major_winning_pct; run; proc print data=tennis1 (obs=50); * print the first 5 observations; format major_winning_pct percent8.2 overall_winning_pct percent8.2; title 'First 5 Observations Sorted by the Major Winning Percentage'; run; *(c) 2 pts; data tennis2; set tennis1; * add the indicator variable; top10=0; if major_winning_pct ge .81 then top10=1; run; *(d) 3 pts; proc format; * create the format for the indicator variable; value topten 1='In Top Ten' 0='Not In Top Ten'; run; *(e) 5 points; proc print data=tennis2; * print total major title wins by the indicator variable; sum major_titles; by top10; format top10 topten.; pageby top10; title 'Total Major Title Wins'; run; proc sort data=tennis2; * perform nested sort; by top10 descending major_titles descending major_winning_pct; run; proc print data=tennis2 (obs=3); * print first 3 obs for those in top 10; var first_name last_name major_titles major_winning_pct; where top10=1; title 'First 3 Major Winning Percentages of Those in Top 10'; run; proc print data=tennis2 (obs=3); * print first 3 obs for those not in top 10; var first_name last_name major_titles major_winning_pct; where top10=0; title 'First 3 Major Winning Percentages of Those Not in Top 10'; run; *(f) 2 pts; proc print data=tennis2; where major_titles ge 3 and overall_winning_pct le .70; * note the change here; format major_winning_pct percent8.2 overall_winning_pct percent8.2 top10 topten.; title 'Those With At Least 3 Major Titles And Overall Winning Percentage Less Than 70'; var first_name last_name major_titles overall_winning_pct; run;