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

emmys2024.png

 

Emmy Awards are tonight, so tweaked some old SAS ODS Graphics code and grabbed some data from Yahoo to chart the nominees' chances of winning. Full output for all 25 award categories on GitHub.

 

* Fun With SAS ODS Graphics: 2024 Emmy Nominee Odds & Probabilities
  Data soure: yahoo.com/entertainment/primetime-emmy-predictions-2024-final-160032406.html
  Odds-to-probability calc from en.wikipedia.org/wiki/Mathematics_of_bookmaking;
  
data emmys;                                                             * Read in data;
length category award nominee odds $ 255.; 
retain category award; 
retain minx .005 maxX .295;                                             * X-axis positions for nominee, odds;
infile '~/Emmys2024Odds.txt';
input;
if verify(_infile_,'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=0 then                 /* Category header? */ 
  do; category=_infile_; delete; end;
if not(index(_infile_,'/')>0 and find(_infile_,' - ')>0) then           /* Award header? */
  do; award=_infile_; seq=0; delete; end;
seq+1;                                                                  * Process nominee odds;
seqx=put(seq,z2.);                                                      * Maintain nominee sequence order;
nominee=substr(_infile_,1,find(_infile_,' - ')-1);                      * Grab nominee;
odds=substr(_infile_,find(_infile_,' - ')+3);                           * Grab odds;
probability=scan(odds,2,'/')/(scan(odds,1,'/')+scan(odds,2,'/'));       * Calc probability;
nominee=trim(nominee)||', '||compress(put(probability,percent7.1),' '); * Append probability to nominee;
 
ods graphics / width=16in height=9in noborder outputfmt=svg;            * SVG format to make image scalable;
proc sgpanel data=emmys noautolegend des="2024 Emmy Awards";            * Draw charts for nine awards in a 3x3 grid on each page (25 awards total);   
panelby award / headerattrs=(weight=bold color=black) novarname nowall noheaderborder noborder rows=3 columns=3 headerbackcolor=white sparse skipemptycells; 
hbarparm category=seqx response=probability / nooutline fillattrs=(color=cXA8D8FF); * Bar chart with light blue bars;
text x=minX y=seqx text=nominee / position=right strip contributeoffsets=none textattrs=(size=9pt color=black) splitchar='|' splitpolicy=splitalways; * Text plot of nominee + probability (left-aligned over bars);
text x=maxX y=seqx text=odds / position=left strip contributeoffsets=none textattrs=(size=9pt color=black); * Text plot showing fractional odds (to the right of nominees);
rowaxis display=(nolabel novalues noticks noline);                      * Suppress most axis info, but show probabilities; 
colaxis display=(nolabel noticks) values=(0 .1 .2 .3) valuesdisplay=('0%' '10%' '20%' '30%') grid valueattrs=(size=8pt);
run;

 

DETAIL

bestcomedyseries.png

2 REPLIES 2
ChrisHemedinger
Community Manager

And...Shogun really cleaned up! Thanks for the great visualization @tc !

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
DanH_sas
SAS Super FREQ

This is a great technique to simulate independent discrete axes in a PANEL layout using SGPANEL. Nice job!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 598 views
  • 7 likes
  • 3 in conversation