<?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 Re: Fun w/SAS ODS Graphics: Ch-ch-ch-ch-Changes - Vector plots of YOY stats for MLB's Top 10 HR lead in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364448#M12655</link>
    <description>&lt;P&gt;&lt;STRONG&gt;SAS OUTPUT (&lt;A href="https://communities.sas.com/t5/image/serverpage/image-id/9237iC47B2A835E452019/image-size/original?v=1.0&amp;amp;px=-1" target="_self"&gt;VIEW LARGER IMAGE&lt;/A&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9237iC47B2A835E452019/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="ColorBands.png" title="ColorBands.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, that does make a difference! Seems I can't use the nifty COLORBANDS= COLAXIS option here since&amp;nbsp;my y-axis isn't DISCRETE, but a quick Google search turned up a&amp;nbsp;SAS 9.3 tip from&amp;nbsp;an &lt;A href="http://support.sas.com/resources/papers/proceedings14/SAS096-2014.pdf" target="_self"&gt;old paper&lt;/A&gt;&amp;nbsp;of yours that did the trick.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;refline 1 3 5 7 9 / axis=y transparency=.85 lineattrs=(thickness=40pt color=green);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2017 03:04:45 GMT</pubDate>
    <dc:creator>tc</dc:creator>
    <dc:date>2017-06-06T03:04:45Z</dc:date>
    <item>
      <title>Fun w/SAS ODS Graphics: Ch-ch-ch-ch-Changes - Vector plots of YOY stats for MLB's Top 10 HR leaders</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364205#M12643</link>
      <description>&lt;P&gt;&lt;STRONG&gt;SAS OUTPUT (&lt;A href="https://communities.sas.com/t5/image/serverpage/image-id/9227i2734246F8020594E/image-size/original?v=1.0&amp;amp;px=-1" target="_self"&gt;VIEW LARGER IMAGE&lt;/A&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9227i2734246F8020594E/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="MlbYoyStats.png" title="MlbYoyStats.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Was recently looking for ideas on how to display Ch-ch-ch-ch-Changes, so I reread Stephen Few's excellent &lt;A href="https://www.perceptualedge.com/articles/visual_business_intelligence/displaying_change_between_two_points_in_time.pdf" target="_self"&gt;Displaying Change Between Two Points in Time&lt;/A&gt;. Drawing inspiration from the Range Bar Graph and side-by-side combinations of graphs described therein, here's my chock-full-o'numbers SAS ODS Graphics vector plot look at selected year-over-year stats for Major League Baseball's Top 10 home run leaders of 2016.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SAS CODE&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*-&amp;gt; Fun w/SAS ODS Graphics: Vector plots of YOY stats for MLB 2016 Top 10 home run leaders;
                                                   /* Data from espn.com (1 row per player/year */
proc import datafile='/folders/myfolders/2016MlbHrLeaders.xlsx' dbms=xlsx out=MlbHrLeaders2016 replace;
                                                   /* Transform to 1 row per player/stat */
proc transpose data=MlbHrLeaders2016 out=hrleaders prefix=X name=STAT;  
by player notsorted; id year; var hr bb so gp;

data hrleaders;                                    /* Add some calculated fields for plotting */
set hrleaders;
playernum=floor((_n_-1)/4)+1;                      /* 4 rows per player (1 for each stat) */
xlo=min(of x2015 x2016);                           /* Label for left side of vector */
xlotext=put(xlo,3.)||'   ';                        /* Add some padding */
xhi=max(of x2015 x2016);                           /* Label for right side of vector */
xhitext='   '||compress(put(xhi,3.));              /* Add some padding */
chg=x2016-x2015;                                   /* YOY change */
pctchg=(x2016-x2015)/x2015;                        /* YOY % change */
xmid=(xlo+xhi)/2;                                  /* X coordinate for YOY change measures */
ymid1=playernum+.1;                                /* Y coordinate for YOY change (padding) */
ymid2=playernum-.1;                                /* Y coordinate for YOY percent change (padding) */

proc sql;                                          /* Create format to print player name instead of # */
create table pfmt as select distinct 'pfmt' as fmtname, playernum as start, player as label from hrleaders;
proc format cntlin=pfmt;

ods graphics /reset height=6.75in width=10.5in;    /* Time to plot! */
proc sgpanel data=hrleaders noautolegend;          /* Panel by stat - homers, walks, strikeouts, games played */
panelby stat / onepanel rows=1 uniscale=row sort=data novarname headerattrs=(size=8pt);
title height=10pt "MLB 2016 TOP 10 HOME RUN LEADERS - YOY STATS";
vector x=x2016 y=playernum / xorigin=x2015 yorigin=playernum;                 /* Plot prior/current year stats */
text x=xlo y=playernum text=xlotext / position=left textattrs=(size=7.5pt);
text x=xhi y=playernum text=xhitext / position=right textattrs=(size=7.5pt);
text x=xmid y=ymid2 text=chg / position=top strip textattrs=(size=7pt);       /* Plot YOY change */
text x=xmid y=ymid1 text=pctchg / position=bottom strip textattrs=(size=7pt); /* Plot YOY % change */
colaxis display=(nolabel) grid valueattrs=(size=7pt);
rowaxis display=(nolabel) values=(1 to 10 by 1) valueattrs=(size=8pt) offsetmin=.05 offsetmax=.05 reverse;
format playernum pfmt. chg 4. pctchg percent7.1 xlotext $char6.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;SCREENSHOT OF INPUT DATA (CUT-AND-PASTED FROM ESPN.COM)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9228iC7E7F8473E5BFDA7/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="MLBstats.png" title="MLBstats.png" /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 04:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364205#M12643</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2017-06-05T04:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Fun w/SAS ODS Graphics: Ch-ch-ch-ch-Changes - Vector plots of YOY stats for MLB's Top 10 HR lead</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364266#M12645</link>
      <description>&lt;P&gt;Very interesting. &amp;nbsp;I would suggest horizontal color bands on rowaxis to help differentiate the rows of data.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 13:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364266#M12645</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-06-05T13:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Fun w/SAS ODS Graphics: Ch-ch-ch-ch-Changes - Vector plots of YOY stats for MLB's Top 10 HR lead</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364448#M12655</link>
      <description>&lt;P&gt;&lt;STRONG&gt;SAS OUTPUT (&lt;A href="https://communities.sas.com/t5/image/serverpage/image-id/9237iC47B2A835E452019/image-size/original?v=1.0&amp;amp;px=-1" target="_self"&gt;VIEW LARGER IMAGE&lt;/A&gt;)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9237iC47B2A835E452019/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="ColorBands.png" title="ColorBands.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, that does make a difference! Seems I can't use the nifty COLORBANDS= COLAXIS option here since&amp;nbsp;my y-axis isn't DISCRETE, but a quick Google search turned up a&amp;nbsp;SAS 9.3 tip from&amp;nbsp;an &lt;A href="http://support.sas.com/resources/papers/proceedings14/SAS096-2014.pdf" target="_self"&gt;old paper&lt;/A&gt;&amp;nbsp;of yours that did the trick.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;refline 1 3 5 7 9 / axis=y transparency=.85 lineattrs=(thickness=40pt color=green);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 03:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-w-SAS-ODS-Graphics-Ch-ch-ch-ch-Changes-Vector-plots-of-YOY/m-p/364448#M12655</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2017-06-06T03:04:45Z</dc:date>
    </item>
  </channel>
</rss>

