<?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 with SAS ODS Graphics: Thar's Gold (and Silver and Bronze) in Them Thar Olympics! in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760437#M21823</link>
    <description>Very nice! The SGPANEL approach requires less width (countries need only appear once) and lets one use UNISCALE=ROW to float the x-axis scales for the medal types + totals if desired to increase separation!</description>
    <pubDate>Mon, 09 Aug 2021 18:06:24 GMT</pubDate>
    <dc:creator>tc</dc:creator>
    <dc:date>2021-08-09T18:06:24Z</dc:date>
    <item>
      <title>Fun with SAS ODS Graphics: Thar's Gold (and Silver and Bronze) in Them Thar Olympics!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760294#M21819</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tokyo 2020 Summer Olympic Games - Top 5 Medal-Winning Countries" style="width: 816px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62387iE7AF8D243A293EFF/image-size/large?v=v2&amp;amp;px=999" role="button" title="tokyo2021medals.png" alt="Tokyo 2020 Summer Olympic Games - Top 5 Medal-Winning Countries" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Tokyo 2020 Summer Olympic Games - Top 5 Medal-Winning Countries&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Inspired by simplexCT's neat &lt;A href="https://simplexct.com/how-to-create-a-flag-chart-in-excel" target="_self"&gt;How to Create a Flag Chart in Excel&lt;/A&gt; (countries winning the most Summer Olympics medals from 1896-2016), here's a SAS ODS Graphics scatter plot with flag markers for the top 5 medal-winning countries at the just-concluded Tokyo 2020 Olympic Games (with a gold-silver-bronze bar chart tossed in for background color!).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Fun with SAS ODS Graphics: Thar's Gold (and Silver and Bronze) in Them Thar Olympics!
  Based on simplexCT's neat Excel Flag Chart simplexct.com/how-to-create-a-flag-chart-in-excel 
  Data, flag icons courtesy of Google google.com/search?q=olympic+medal+count;

data medals;                                               * Read data for top 5 medal-winning countries;
input Rank Country $15.  Gold  Silver  Bronze  Total;
datalines;
1 United States  39  41  33  113
2 China          38  32  18  88
3 Japan          27  14  17  58
4 Great Britain  22  21  22  65
5 ROC            20  28  23  71
;                                                          * Transpose from 1 row per country to 1 row per country/medal;               
proc transpose data=medals out=medalsT(rename=(_name_=Medal col1=Medals)); 
by rank country notsorted;
var Gold  Silver  Bronze  Total;
                                                           * Create temp variables for charting, exclude totals;
proc sql noprint;
create table medalsT2 as 
select m.*, max(medals)+1 as maxmedals, 
       case medal when 'Gold' then 1 when 'Silver' then 2 when 'Bronze' then 3 end as medalnum,
       trim(upcase(country))||' '||compress(put(medals,comma5.)) as countrymedals 
       from medalsT(where=(medal^='Total')) m;
select min(medals)-1 into :minmedals from medalsT2;  
select max(medals)+1 into :maxmedals from medalsT2;       
                                                           * Format medal numbers; 
proc format;
value medal 1='GOLD' 2='SILVER' 3='BRONZE' other=' ';
                                                           * Scatter plot of medals won with country flag markers;
ods graphics / width=8.5in height=8.5in attrpriority=none; * Bar chart used for gold-silver-bronze background;
proc sgplot data=medalsT2 noautolegend nowall noborder;
inset '2020 Olympics' / position=topright textattrs=(size=16pt weight=bold);
styleattrs datasymbols=(US_Flag CH_Flag JP_Flag GB_flag ROC_Flag);   
symbolimage name=US_Flag  image="/home/ted.conway/flags/US_Flag.png"; * Flag icons for top 5 medal-winning countries;
symbolimage name=CH_Flag  image="/home/ted.conway/flags/CH_Flag.png";
symbolimage name=JP_Flag  image="/home/ted.conway/flags/JP_Flag.png";
symbolimage name=GB_Flag  image="/home/ted.conway/flags/GB_Flag.png";
symbolimage name=ROC_Flag image="/home/ted.conway/flags/ROC_Flag.png";
vbarbasic medalnum / response=maxmedals stat=mean barwidth=1 colorresponse=medalnum colormodel=(gold silver cXcd7f32) 
          nooutline baselineattrs=(thickness=0) transparency=.5 baseline=&amp;amp;minmedals dataskin=pressed;
scatter x=medalnum y=medals / group=rank markerattrs=(size=18pt) datalabel=countrymedals datalabelpos=right datalabelattrs=(color=black);
xaxis display=(nolabel noline noticks) type=linear min=.5 max=3.5 offsetmin=0 offsetmax=0 valuesformat=medal.; 
yaxis display=(noline noticks) label="MEDALS" grid ranges=(&amp;amp;minmedals-&amp;amp;maxmedals) offsetmin=0 offsetmax=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="China" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62388i3AE45894F634AB1D/image-size/small?v=v2&amp;amp;px=200" role="button" title="CH_Flag.png" alt="China" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;China&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Great Britain" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62392i1FD174F039B57F5C/image-size/small?v=v2&amp;amp;px=200" role="button" title="GB_Flag.png" alt="Great Britain" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Great Britain&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Japan" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62390i148939CA449CE5D1/image-size/small?v=v2&amp;amp;px=200" role="button" title="JP_Flag.png" alt="Japan" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Japan&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Russian Olympic Committee" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62389i0689358488990FD5/image-size/small?v=v2&amp;amp;px=200" role="button" title="ROC_Flag.png" alt="Russian Olympic Committee" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Russian Olympic Committee&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="United States" style="width: 160px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62393i688D58DC0DBB326E/image-size/small?v=v2&amp;amp;px=200" role="button" title="US_Flag.png" alt="United States" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;United States&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 01:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760294#M21819</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2021-08-09T01:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fun with SAS ODS Graphics: Thar's Gold (and Silver and Bronze) in Them Thar Olympics!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760365#M21822</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4628"&gt;@tc&lt;/a&gt; , How about this one ?&lt;/P&gt;
&lt;P&gt;It is from Graph Speaking Blog .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data medals;                                           
input Rank Country $15.  Gold  Silver  Bronze  Total;
datalines;
1 United States  39  41  33  113
2 China          38  32  18  88
3 Japan          27  14  17  58
4 Great Britain  22  21  22  65
5 ROC            20  28  23  71
; 
proc transpose data=medals out=want;
by  Rank Country ;
var Gold  Silver  Bronze  Total;
run;
data want;
 set want;
 if _name_='Gold' then order=1;
  else  if _name_='Silver' then order=2;
   else  if _name_='Bronze' then order=3;
    else  order=4;
run;

proc sort data=want;by order;run;
ods graphics/reset=all;
proc sgpanel data=want noautolegend;
title '2020 Olympics';
panelby _NAME_ / layout=panel columns=4 onepanel sort=data  novarname spacing=5;
    styleattrs datacontrastcolors=(gold Silver cXcd7f32  navy );
    dot Country / response=col1 group=_NAME_ 
        nostatlabel markerattrs=(symbol=circlefilled size=20) datalabel;
    rowaxis discreteorder=data display=(nolabel) fitpolicy=none;
    colaxis integer display=(nolabel);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1628518234387.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62400i65DCB9C06CDAA6D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1628518234387.png" alt="Ksharp_0-1628518234387.png" /&gt;&lt;/span&gt;&lt;/P&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 14:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760365#M21822</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-09T14:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Fun with SAS ODS Graphics: Thar's Gold (and Silver and Bronze) in Them Thar Olympics!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760437#M21823</link>
      <description>Very nice! The SGPANEL approach requires less width (countries need only appear once) and lets one use UNISCALE=ROW to float the x-axis scales for the medal types + totals if desired to increase separation!</description>
      <pubDate>Mon, 09 Aug 2021 18:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-with-SAS-ODS-Graphics-Thar-s-Gold-and-Silver-and-Bronze-in/m-p/760437#M21823</guid>
      <dc:creator>tc</dc:creator>
      <dc:date>2021-08-09T18:06:24Z</dc:date>
    </item>
  </channel>
</rss>

