Super Bowl LV QB Boxplot Matchup
Pre-gaming with SAS ODS Graphics! 🏈
* Fun w/SAS ODS Graphics: Super Bowl LV QB box plot pass yardage matchup (Brady vs. Mahomes)
Football markers courtesy of Darrin Loeliger thenounproject.com/search/?q=football&i=900778;
proc import file='/folders/myfolders/QB.xlsx' dbms=xlsx out=qb replace; * Grab 2020 season QB stats (copied-and-pasted from NFL.com);
%SGANNO; * Anotate chart with NFL.com potos of Brady, Mahones using SAS-provided macros;
data qbpics;
%SGIMAGE (image="/folders/myfolders/brady.jpg",drawspace="DATAVALUE",xc1="Tom Brady",y1=5,height=140,heightunit="DATA",anchor="BOTTOM");
%SGIMAGE (image="/folders/myfolders/mahomes.jpg",drawspace="DATAVALUE",xc1="Patrick Mahomes",y1=5,height=140,heightunit="DATA",anchor="BOTTOM");
proc sgplot data=qb noautolegend sganno=qbpics; * Annotated box + scatter plot of passing yardage in each game of 2020 season;
inset "SUPER BOWL LV" / textattrs=(size=14pt weight=bold) position=top;
symbolimage name=football image='/folders/myfolders/football.png'; * Use football image for scatterplot markers;
scatter y=YDS x=QB / markerattrs=(symbol=football size=24pt); * Markers with passing yards in each of the 2020 games (pre- and post-season);
vbox YDS / category=QB boxwidth=.25 nofill meanattrs=(color=red symbol=diamondfilled); * Boxplot to show distributions (quartiles + mean);
xaxis grid display=(nolabel) discreteorder=data;
yaxis display=all label="PASSING YARDS - 2020 SEASON GAMES" min=0 offsetmin=0;
inset "VS" / textattrs=(size=12pt weight=bold) position=bottom;
run;
QB Game Stats (Source: NFL.com)
Nice work TC. One question...why did you not use SymbolImage for the pictures of Brady and Mahomes too? Was annotation easier?
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.
Ready to level-up your skills? Choose your own adventure.