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

SuperBowlLVIIQB.png

 

It's time for the Super Bowl LVII quarterback boxplot matchup, kids! More QB stats for Patrick Mahomes and Jalen Hurts at NFL.com.

 

* Fun With SAS ODS Graphics: Super Bowl LVII QB Boxplot Tale of the Tape (Mahomes vs. Hurts)
  Football markers courtesy of Bruno Landowski thenounproject.com/icon/football-243375/;

proc import file='~/QBLVII.xlsx' dbms=xlsx out=qb replace; * Grab 2022 regular/postseason QB stats (copied-and-pasted from NFL.com); 

%SGANNO;  * Anotate chart with NFL.com potos of Burrow, Stafford using SAS-provided macros;         
data qbpics;
%SGIMAGE (image="/home/ted.conway/Mahomes.png",drawspace="DATAVALUE",xc1="Patrick Mahomes",y1=-10,height=140,heightunit="DATA",anchor="BOTTOM");
%SGIMAGE (image="/home/ted.conway/Hurts.png",drawspace="DATAVALUE",xc1="Jalen Hurts",y1=-10,height=140,heightunit="DATA",anchor="BOTTOM");

proc sql; * Only create labels for highest and lowest passing yardage games;
create table qb3 as select qb.*, case when yds=minyds or yds=maxyds then Yds end as Yds2
from qb join 
(select qb, min(yds) as minYds, max(yds) as maxYds from qb group by 1) as qb2 on qb.qb=qb2.qb; proc sgplot data=qb3 noautolegend sganno=qbpics noborder nowall; * Annotated box + scatter plot of passing yardage in each game of 2022 season; inset "SUPER BOWL LVII" / textattrs=(size=14pt weight=bold) position=top; symbolimage name=football image='/home/ted.conway/football.png'; * Use football image for scatterplot markers; scatter y=YDS x=QB / datalabel=yds2 datalabelpos=left markerattrs=(symbol=football size=24pt) transparency=0; * Markers with passing yards in each of the 2022 games (pre- and post-season); vbox YDS / category=QB boxwidth=.25 nofill meanattrs=(color=red symbol=diamondfilled); * Boxplot to show distributions (quartiles + mean); xaxis display=(noline noticks nolabel) discreteorder=data; yaxis display=all label="PASSING YARDS IN EACH 2022 REGULAR/POSTSEASON GAME" min=-15 offsetmin=0; inset "QB" "PASSING" "MATCHUP" / valuealign=center textattrs=(size=12pt weight=bold) position=bottom; run;

  

DATA SOURCE: NFL.COM

NFL2022DataQB.jpg

 

 

1 REPLY 1

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
  • 1 reply
  • 1063 views
  • 10 likes
  • 2 in conversation