BookmarkSubscribeRSS Feed
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

SuperBowl2025MahomeaHurts.png

 

The Kansas City Chiefs' Patrick Mahomes will match up against the Philadelphia Eagles' Jalen Hurts on Sunday in Super Bowl LIX, a rematch of Super Bowl LVII (which KC won). Used a SAS ODS Graphics boxplot to compare the two quarterbacks' performance two years ago, so this time here's a simple scatter plot comparison of the pair's passing yardages and completion percentages for the 2024-2025 regular season games. Go [your team here]!

 

* Fun With SAS ODS Graphics: Super Bowl LIX, Mahomes vs. Hurts II;
                                      * Read in NFL.com quarterback data from Excel sheets and merge;
proc import file='/home/ted.conway/MahomesHurts2024.xlsx' out=mahomes dbms=xlsx replace; sheet="Mahomes";
proc import file='/home/ted.conway/MahomesHurts2024.xlsx' out=hurts dbms=xlsx replace; sheet="Hurts";

proc sql;                             * Merge data, compute completion %, filter out games if which they played little/none;
create table mahomeshurts as 
select 'Mahomes' as QB, yds, comp/att as comp_pct from Mahomes where att>=5 union all
select 'Hurts' as QB, yds, comp/att as comp_pct from Hurts where att>=5;

data myattrmap;                       * Assign marker images to quarterbacks (MS-Word football icons in team color);
input ID $ value $ markersymbol $;
datalines;
myid Mahomes chiefs
myid Hurts eagles
;  
%SGANNO;                              * Create file used to annotate chart with NFL.com potos of Mahomes/Hurts using SAS-provided macros;         
data qbpics;
%SGIMAGE (image="/home/ted.conway/mahomes2025.png",drawspace="DATAVALUE",x1=.56,y1space="LAYOUTPERCENT",y1=0,height=12,heightunit="percent",anchor="BOTTOM"); * Mahomes (bottom left);
%SGIMAGE (image="/home/ted.conway/hurts2025.png",drawspace="DATAVALUE",x1=.74,y1space="LAYOUTPERCENT",y1=0,height=12,heightunit="percent",anchor="BOTTOM"); * Hurts (bottom right);
                                      * Generate a scatter chart of completion % vs yards for each game;
ods graphics / reset antialias height=7.5in width=7.5in border=off imagefmt=svg;
proc sgplot data=mahomeshurts nowall noborder dattrmap=myattrmap sganno=qbpics subpixel; * Map quarterbacks to their football icons and display their photos;
inset 'SUPER BOWL LIX' '   QB MATCHUP' / border textattrs=(color=white weight=bold size=14pt) position=top; * Chart title;
symbolimage name=chiefs image="/home/ted.conway/chiefs2.png"; * Kansas City Chiefs team-colored MS-Word football icon;
symbolimage name=eagles image="/home/ted.conway/eagles2.png"; * Philadelphia Eagles team-colored MS-Word football icon;
styleattrs backcolor=cxbad8bc;         * Pastel greenish-background;
scatter x=comp_pct y=yds / group=qb markerattrs=(size=24pt) attrid=myid; * Scatter chart of completion percentage X yards X QB;
label yds="Passing Yards (Regular Season Games With 5+ Attempts)" comp_pct="Completion Percentage"; * x/y-axis lables;
format comp_pct percent5.1;            * Format completion percentage;
keylegend / title="" noopaque valueattrs=(color=white weight=bold); * Chart legend options;
xaxis display=(noticks noline) grid labelattrs=(color=white weight=bold) valueattrs=(color=white weight=bold) labelattrs=(color=white weight=bold); * x-axis options;
yaxis display=(noticks noline) grid labelattrs=(color=white weight=bold) valueattrs=(color=white weight=bold) labelattrs=(color=white weight=bold); * y-axis ooptions; 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 1176 views
  • 3 likes
  • 1 in conversation