BookmarkSubscribeRSS Feed
tc
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 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)QB Game Stats (Source: NFL.com)

3 REPLIES 3
Jay54
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?

tc
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!
tc
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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 849 views
  • 4 likes
  • 2 in conversation