First gold medal for Team USA! Enjoy the Olympics, all!
* Fun With SAS ODS Graphics: USA Men's 4x100m Freestyle Relay Stacked Bar Chart
Source: olympics.com/en/paris-2024/results/swimming/men-s-4-x-100m-freestyle-relay/fnl-000100--;
proc import file="~/UsaMen4x100FreeRelay.xlsx" out=usa dbms=xlsx replace; * Get data;
data usaswimmers; * Reshape data;
set usa;
split='1st 50m'; splittime='50m'n; output; * 50M split;
split='2nd 50m'; splittime='100m'n-'50m'n; output; * 100M split; * Calc split times;
%SGANNO; * Add photos using SAS macros;
data swimmerpics;
%SGIMAGE (image="/home/ted.conway/JackAlexy.png",drawspace="DATAVALUE",xc1="Jack Alexy",y1=0,height=9,heightunit="DATA",anchor="BOTTOM");
%SGIMAGE (image="/home/ted.conway/ChrisGuiliano.png",drawspace="DATAVALUE",xc1="Chris Guiliano",y1=0,height=9,heightunit="DATA",anchor="BOTTOM");
%SGIMAGE (image="/home/ted.conway/HunterArmstrong.png",drawspace="DATAVALUE",xc1="Hunter Armstrong",y1=0,height=9,heightunit="DATA",anchor="BOTTOM");
%SGIMAGE (image="/home/ted.conway/CaelebDressel.png",drawspace="DATAVALUE",xc1="Caeleb Dressel",y1=0,height=9,heightunit="DATA",anchor="BOTTOM");
ods graphics / noborder; * Stacked bar charts of each swimmer's times;
proc sgplot data=usaswimmers nowall noborder sganno=swimmerpics; * Annotate each bar with swimmer's pic;
styleattrs datacolors=(cx05C3DD cx05D0EB) backcolor=gold; * Aqua bars, gold background;
inset "USA Men's 4x100M Freestyle Relay Gold Medal-Winning Team (3:09.28)" / position=top textattrs=(size=12.75pt);
vbar swimmer / response=splittime group=split datalabel datalabelattrs=(size=10.5pt)
seglabel seglabelformat=mmss7.2 seglabelattrs=(size=10.5pt);
xaxis display=(nolabel) discreteorder=data;
yaxis display=none tickvalueformat=mmss. offsetmax=.125;
keylegend / title="" noborder noopaque;
format splittime mmss7.2;
run;
Input Data
Swimmer |
Reaction Time |
50m |
100m |
Total Time |
Jack Alexy |
0:00.69 |
0:22.70 |
0:47.67 |
0:47.67 |
Chris Guiliano |
0:00.11 |
0:21.70 |
0:47.33 |
1:35.00 |
Hunter Armstrong |
0:00.37 |
0:22.35 |
0:46.75 |
2:21.75 |
Caeleb Dressel |
0:00.27 |
0:22.39 |
0:47.53 |
3:09.28 |