<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Fun With ODS Graphics: Box Plot Distribution of Top 50 Home Run Leaders of 1910-2015 in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-ODS-Graphics-Box-Plot-Distribution-of-Top-50-Home-Run/m-p/301895#M10653</link>
    <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5113i390128EBEC0F42DE/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="HR.png" title="HR.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drawing inspiration from Curtis Harris' fine &lt;A href="https://public.tableau.com/profile/curtis.harris#!/vizhome/TheHistoryoftheSingleSeasonHomeRunRecord_0/TheHistoryoftheSingleSeasonHomeRunRecord" target="_blank"&gt;The History of the Single Season Home Run Record&lt;/A&gt;, here's code for a quick box plot take on the same subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; WaPo's &lt;A href="https://www.washingtonpost.com/news/fancy-stats/wp/2016/03/07/the-perfect-storm-that-created-baseballs-biggest-home-run-surge-since-the-steroid-era/" target="_blank"&gt;Baseball just saw its biggest home run surge since the steroids era.&amp;nbsp;Here’s why.&lt;/A&gt;&amp;nbsp;has a nice explanation of&amp;nbsp;some of the reasons behind&amp;nbsp;the rise and fall of the longball.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Box plot distribution of top 50 home run leaders of 1910-2015
  Data sourced from Lahman's Baseball Database (seanlahman.com/baseball-archive/statistics);
  
data homers(keep=playerID yearID teamID HR);                   * Grab batting stats;
infile '/folders/myfolders/BaseBall/Batting.csv' dlm=',' dsd truncover firstobs=2;
input playerID : $10. yearID stint teamID : $3. lgID : $2. G AB R H D T HR;

data players(keep=playerID namefirst namelast compress=char);  * Grab player info;
infile '/folders/myfolders/BaseBall/Master.csv' dlm=',' dsd truncover firstobs=2;
input playerID : $10. birthYear birthMonth birthDay birthCountry : $10. birthState : $10. birthCity: $30. 
      deathYear deathMonth	deathDay deathCountry : $10. deathState : $10. deathCity: $30. 
      nameFirst: $30. nameLast : $30.;

proc rank data=homers out=HRrank ties=low descending;          * Rank players by HR for each season;
by yearId; var HR; ranks HRrank;

proc sql;                                                      * Merge data, tag batters w/60+ HR, keep top 50;
create table HRleaders as
select yearid, hr,
       case when hr&amp;gt;=60 then '   '||trim(namelast)||" ("||put(hr,z2.)||','||put(yearid,z4.)||")" end as HR60
from HRrank, players where HRrank.playerid=players.playerid and HRrank between 1 and 50;

ods listing image_dpi=300 gpath='/folders/myfolders';          * One boxplot/season for top 50 HR hitters;
ods graphics on / reset antialias width=14in height=11in imagename="HR" antialiasmax=6000;
proc sgplot data=hrleaders(where=(yearid&amp;gt;=1910)) noautolegend;
Title "Top 50 Home Run Leaders 1910-2015";
vbox hr / category=yearid boxwidth=.35;
text x=yearid y=HR text=HR60 / position=right;
xaxis display=(nolabel) valueattrs=(size=7pt) type=linear values=(1910 to 2015 by 5) offsetmax=.005;
yaxis display=(nolabel) valueattrs=(size=7pt) grid;
footnote height=7pt "Note: League followed 154 game schedule until 1961, and 162 games since. Number of games varied widely from 1901-1919, and strikes shortened '72, '81, '94, '95 seasons.";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 02 Oct 2016 20:35:10 GMT</pubDate>
    <dc:creator>tc</dc:creator>
    <dc:date>2016-10-02T20:35:10Z</dc:date>
    <item>
      <title>Fun With ODS Graphics: Box Plot Distribution of Top 50 Home Run Leaders of 1910-2015</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-ODS-Graphics-Box-Plot-Distribution-of-Top-50-Home-Run/m-p/301895#M10653</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5113i390128EBEC0F42DE/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="HR.png" title="HR.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drawing inspiration from Curtis Harris' fine &lt;A href="https://public.tableau.com/profile/curtis.harris#!/vizhome/TheHistoryoftheSingleSeasonHomeRunRecord_0/TheHistoryoftheSingleSeasonHomeRunRecord" target="_blank"&gt;The History of the Single Season Home Run Record&lt;/A&gt;, here's code for a quick box plot take on the same subject.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; WaPo's &lt;A href="https://www.washingtonpost.com/news/fancy-stats/wp/2016/03/07/the-perfect-storm-that-created-baseballs-biggest-home-run-surge-since-the-steroid-era/" target="_blank"&gt;Baseball just saw its biggest home run surge since the steroids era.&amp;nbsp;Here’s why.&lt;/A&gt;&amp;nbsp;has a nice explanation of&amp;nbsp;some of the reasons behind&amp;nbsp;the rise and fall of the longball.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Box plot distribution of top 50 home run leaders of 1910-2015
  Data sourced from Lahman's Baseball Database (seanlahman.com/baseball-archive/statistics);
  
data homers(keep=playerID yearID teamID HR);                   * Grab batting stats;
infile '/folders/myfolders/BaseBall/Batting.csv' dlm=',' dsd truncover firstobs=2;
input playerID : $10. yearID stint teamID : $3. lgID : $2. G AB R H D T HR;

data players(keep=playerID namefirst namelast compress=char);  * Grab player info;
infile '/folders/myfolders/BaseBall/Master.csv' dlm=',' dsd truncover firstobs=2;
input playerID : $10. birthYear birthMonth birthDay birthCountry : $10. birthState : $10. birthCity: $30. 
      deathYear deathMonth	deathDay deathCountry : $10. deathState : $10. deathCity: $30. 
      nameFirst: $30. nameLast : $30.;

proc rank data=homers out=HRrank ties=low descending;          * Rank players by HR for each season;
by yearId; var HR; ranks HRrank;

proc sql;                                                      * Merge data, tag batters w/60+ HR, keep top 50;
create table HRleaders as
select yearid, hr,
       case when hr&amp;gt;=60 then '   '||trim(namelast)||" ("||put(hr,z2.)||','||put(yearid,z4.)||")" end as HR60
from HRrank, players where HRrank.playerid=players.playerid and HRrank between 1 and 50;

ods listing image_dpi=300 gpath='/folders/myfolders';          * One boxplot/season for top 50 HR hitters;
ods graphics on / reset antialias width=14in height=11in imagename="HR" antialiasmax=6000;
proc sgplot data=hrleaders(where=(yearid&amp;gt;=1910)) noautolegend;
Title "Top 50 Home Run Leaders 1910-2015";
vbox hr / category=yearid boxwidth=.35;
text x=yearid y=HR text=HR60 / position=right;
xaxis display=(nolabel) valueattrs=(size=7pt) type=linear values=(1910 to 2015 by 5) offsetmax=.005;
yaxis display=(nolabel) valueattrs=(size=7pt) grid;
footnote height=7pt "Note: League followed 154 game schedule until 1961, and 162 games since. Number of games varied widely from 1901-1919, and strikes shortened '72, '81, '94, '95 seasons.";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Oct 2016 20:35:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-ODS-Graphics-Box-Plot-Distribution-of-Top-50-Home-Run/m-p/301895#M10653</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2016-10-02T20:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With ODS Graphics: Box Plot Distribution of Top 50 Home Run Leaders of 1910-2015</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-ODS-Graphics-Box-Plot-Distribution-of-Top-50-Home-Run/m-p/302061#M10658</link>
      <description>&lt;P&gt;For added fun: Normalize this to the number of games played.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 14:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-ODS-Graphics-Box-Plot-Distribution-of-Top-50-Home-Run/m-p/302061#M10658</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-03T14:23:50Z</dc:date>
    </item>
  </channel>
</rss>

