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

Super Bowl LV QB Boxplot MatchupSuper 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;

proc import file='/folders/myfolders/QB.xlsx' dbms=xlsx out=qb replace;  * Grab 2020 season QB stats (copied-and-pasted from; 

%SGANNO;  * Anotate chart with 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;


 QB Game Stats (Source: Game Stats (Source:

Meteorite | Level 14

Nice work TC.  One question...why did you not use SymbolImage for the pictures of Brady and Mahomes too?  Was annotation easier?

Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10
Hey. Sanjay. Funny you should ask - I had the SYMBOLIMAGE statements coded up, but decided to opt for annotation. SYMBOLIMAGE could've done the trick, but thought I might be resizing the graph and specifying the image height in terms of data values (a neat option, btw!) would cause it to self-adjust. Tuns out I never did, but you know how programmers are sometimes loathe to change code that's working!
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10
Oops-looks like I responded in the Tags box and it parsed things out! Fixed now!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2 in conversation