With the 2022 SAS Championship golf tournament events kicking off Monday, here's a quick SAS ODS Graphics hole-by-hole, over/under par look at Lee Janzen's 2021 SAS Championship winning rounds, which got him into a playoff that he won on the first hole with yet another birdie.
*==> Fun With SAS ODS Graphics: Look at the Birdies! A Hole-by-Hole Look at SAS Championship 2021 Winner Lee Janzen's Rounds;
proc format; * Format to print leading +/- for over/under par scores;
picture parFMT low-<0='000'(prefix='-') 0='9' 0<-high='000'(prefix='+');
data rounds (keep=round hole y score); * Get course pars (18 holes) and Janzen's scores (3 rounds x 18 holes);
infile cards firstobs=2;
array p {18} par1-par18; retain par1-par18; * Arrays for pars, strokes for each hole;
array s {18} strokes1-strokes18;
if _n_=1 then do; input @11 par1-par18; delete; end; * Get pars for each hole;
input @11 strokes1-strokes18; * Get strokes for each hole in a round;
roundNum+1; * Generate label with total score and over/under par for the round;
round="ROUND "||compress(put(roundnum,1.))||': '||compress(put(sum(of strokes:),3.))||' ('||compress(put(sum(of strokes:)-sum(of par:),parFMT.))||')';
do Hole=1 to 18; * Generate one observation per row with round, hole, over/under (y) and score;
y=s(Hole)-p(Hole); * Over/under = score - par;
score=s(Hole);
output;
end;
* Janzen's 2021 SAS Championship hole-by-hole scores (from pgatour.com/players/player.01577.lee-janzen.html/scorecards/s045);
cards;
HOLE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
PAR 4 4 3 4 4 4 5 3 4 4 3 5 4 4 4 4 5 4
ROUND 1 4 4 2 4 4 4 4 2 3 3 3 4 3 4 6 5 4 4
ROUND 2 4 4 4 3 4 4 5 3 4 4 3 4 4 4 4 4 4 4
ROUND 3 5 3 3 4 4 4 5 2 4 3 3 5 3 4 3 4 5 3
;
proc sgpanel data=rounds noautolegend; * Generate scatter/text plots of hole-by-hole scores on a +/- par y-axis;
styleattrs backcolor=cx076652; * RGB code for "Masters Green" (colourlovers.com/color/076652/Masters_Green);
panelby round / headerbackcolor=cx076652 headerattrs=(color=white weight=bold) noheaderborder onepanel novarname uniscale=row
colheaderpos=top columns=1 spacing=5 nowall noborder;
title color=white "SAS Championship 2021 Winner Lee Janzen";
title2 color=white "Hole-by-Hole Scores and +/- Par";
refline 0 / axis=y lineattrs=(color=white); * Par reference line at 0;
scatter x=hole y=y / markerattrs=(symbol=circlefilled color=white size=22pt); * White 'golf ball' markers at +/- par on y-axis;
text x=hole y=y text=score / textattrs=(color=cx076652 size=9pt weight=bold) strip vcenter=bbox position=center; * Display scores on markers;
colaxis display=(nolabel noticks noline) grid gridattrs=(color=white pattern=dot) valueattrs=(color=white) values=(1 to 18 by 1); * X-axis is hole numbers;
rowaxis display=(nolabel noticks noline) valueattrs=(color=white) values=(-2 to 2 by 1) valuesformat=parFMT.; * Y-axis is shots over/under/par;
footnote height=8pt color=white "Data Source: pgatour.com/players/player.01577.lee-janzen.html/scorecards/s045";
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.