<?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 Pie Chart Slice Colors in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/620721#M19465</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to specify pie chart slice colors but keep finding myself at the default colors chosen for me by SAS. I am hoping to correlate charts across distinct data sets, so coordinating colors among the charts would be helpful. There is no auto-recognition of the test in the discreteattrmap, so perhaps that is not feasible for this pie chart, but I will include my attempt below.&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions as to what I am doing wrong? Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* General Demographics - age groups*/&lt;BR /&gt;/* Group 1*/&lt;BR /&gt;proc format;&lt;BR /&gt;value AgeGrp 1-30 ='Age &amp;lt;30'&lt;BR /&gt;30-59 = 'Age 30-59'&lt;BR /&gt;60-100 = 'Age &amp;gt;60';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data=work.analysis_population;&lt;BR /&gt;format SC_AGE AgeGrp.;&lt;BR /&gt;Table SC_AGE;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc template;&lt;BR /&gt;define statgraph pie;&lt;BR /&gt;begingraph;&lt;BR /&gt;discreteattrmap name="AgeAttr";&lt;BR /&gt;value "Age &amp;lt;30" / fillattrs=(color=green);&lt;BR /&gt;value "Age 30-59" / fillattrs=(color=red);&lt;BR /&gt;value "Age &amp;gt;60" / fillattrs=(color=blue);&lt;BR /&gt;enddiscreteattrmap;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;discreteattrvar attrvar=AgeGrp var=SC_AGE attrmap="AgeAttr";&lt;BR /&gt;layout region;&lt;BR /&gt;piechart category=SC_AGE / start=90 categorydirection=clockwise&lt;BR /&gt;datalabelattrs=(size=12) dataskin=matte;&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics / reset width=6.4in height=4.8in imagemap;&lt;/P&gt;&lt;P&gt;proc sgrender data=WORK.analysis_population template=pie;&lt;BR /&gt;format SC_AGE AgeGrp.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods graphics / reset;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2020 00:59:02 GMT</pubDate>
    <dc:creator>sms39</dc:creator>
    <dc:date>2020-01-29T00:59:02Z</dc:date>
    <item>
      <title>Pie Chart Slice Colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/620721#M19465</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to specify pie chart slice colors but keep finding myself at the default colors chosen for me by SAS. I am hoping to correlate charts across distinct data sets, so coordinating colors among the charts would be helpful. There is no auto-recognition of the test in the discreteattrmap, so perhaps that is not feasible for this pie chart, but I will include my attempt below.&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions as to what I am doing wrong? Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* General Demographics - age groups*/&lt;BR /&gt;/* Group 1*/&lt;BR /&gt;proc format;&lt;BR /&gt;value AgeGrp 1-30 ='Age &amp;lt;30'&lt;BR /&gt;30-59 = 'Age 30-59'&lt;BR /&gt;60-100 = 'Age &amp;gt;60';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data=work.analysis_population;&lt;BR /&gt;format SC_AGE AgeGrp.;&lt;BR /&gt;Table SC_AGE;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc template;&lt;BR /&gt;define statgraph pie;&lt;BR /&gt;begingraph;&lt;BR /&gt;discreteattrmap name="AgeAttr";&lt;BR /&gt;value "Age &amp;lt;30" / fillattrs=(color=green);&lt;BR /&gt;value "Age 30-59" / fillattrs=(color=red);&lt;BR /&gt;value "Age &amp;gt;60" / fillattrs=(color=blue);&lt;BR /&gt;enddiscreteattrmap;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;discreteattrvar attrvar=AgeGrp var=SC_AGE attrmap="AgeAttr";&lt;BR /&gt;layout region;&lt;BR /&gt;piechart category=SC_AGE / start=90 categorydirection=clockwise&lt;BR /&gt;datalabelattrs=(size=12) dataskin=matte;&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics / reset width=6.4in height=4.8in imagemap;&lt;/P&gt;&lt;P&gt;proc sgrender data=WORK.analysis_population template=pie;&lt;BR /&gt;format SC_AGE AgeGrp.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;ods graphics / reset;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 00:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/620721#M19465</guid>
      <dc:creator>sms39</dc:creator>
      <dc:date>2020-01-29T00:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart Slice Colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/624728#M19466</link>
      <description>&lt;P&gt;Moved to graphics stream.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 03:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/624728#M19466</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-02-14T03:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart Slice Colors</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/625138#M19482</link>
      <description>&lt;P&gt;I don't use the graph template language, but I was able to use an attribute map data set with several SASHELP data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As the log notes, SGPIE is pre-production for SAS 9.4M6.&amp;nbsp; I tried to control the color for the "Other" slice when using AgeAtStart for the SASHELP.HEART data set, but couldn't get the syntax to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value AgeGrp 
    1 - 29 ='Age &amp;lt; 30'
    30 - 59 ='Age 30 - 59'
    60 - 100 ='Age 60+'
      ;
run;

data attrmap;
  length ID $ 8 FillColor $ 9 value $ 11;
  infile datalines dlm='|';
  input id $ fillcolor $ value $;
  datalines;
myagegrp|green|Age &amp;lt; 30
myagegrp|red|Age 30 - 59
myagegrp|blue|Age 60+
     ;
run;

ods listing gpath='/folders/myfolders/ODS Graphics/SGPIE'
    style=HTMLBlue;

ods graphics / noborder
               imagename='SGPIE_example_'
               reset=index(1);

proc sgpie data=sashelp.bmimen dattrmap=attrmap;
  pie age / startangle=90 direction=clockwise attrid=myagegrp
            datalabelattrs=(size=12) dataskin=matte;
  format age AgeGrp. ;
  title 'SASHELP.BMIMEN data set';
run;

proc sgpie data=sashelp.class dattrmap=attrmap;
  pie age / startangle=90 direction=clockwise attrid=myagegrp
            datalabelattrs=(size=12) dataskin=matte;
  format age AgeGrp. ;
  title 'SASHELP.CLASS data set';
run;

proc sgpie data=sashelp.heart dattrmap=attrmap;
  pie AgeAtStart / startangle=90 direction=clockwise attrid=myagegrp
                   datalabelattrs=(size=12) dataskin=matte;
  format AgeAtStart AgeGrp. ;
  title 'SASHELP.HEART data set';
  title2 'AgeAtStart';
run;

proc sgpie data=sashelp.heart dattrmap=attrmap;
  pie AgeAtDeath / startangle=90 direction=clockwise attrid=myagegrp
                   datalabelattrs=(size=12) dataskin=matte;
  format AgeAtDeath AgeGrp. ;
  title 'SASHELP.HEART data set';
  title2 'AgeAtDeath';
run;

proc sgpie data=sashelp.heart dattrmap=attrmap;
  pie AgeCHDdiag / startangle=90 direction=clockwise attrid=myagegrp
                   datalabelattrs=(size=12) dataskin=matte;
  format AgeCHDdiag AgeGrp. ;
  title 'SASHELP.HEART data set';
  title2 'AgeCHDdiag';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;These are the pie charts:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pie chart of age in SASHELP.BMIMEN" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36160i2F037DF5E40BA822/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPIE_example_1.png" alt="Pie chart of age in SASHELP.BMIMEN" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pie chart of age in SASHELP.BMIMEN&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pie chart of age in SASHELP.CLASS" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36161iC8698BDD52DE81B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPIE_example_2.png" alt="Pie chart of age in SASHELP.CLASS" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pie chart of age in SASHELP.CLASS&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pie chart of AgeAtStart in SASHELP.HEART" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36162iE1EBE0B384BDE430/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPIE_example_3.png" alt="Pie chart of AgeAtStart in SASHELP.HEART" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pie chart of AgeAtStart in SASHELP.HEART&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pie chart of AgeAtDeath in SASHELP.HEART" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36163iE31C9F23B2A3822F/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPIE_example_4.png" alt="Pie chart of AgeAtDeath in SASHELP.HEART" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pie chart of AgeAtDeath in SASHELP.HEART&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pie chart of AgeCHDdiag in SASHELP.HEART" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36164iAAED54016BDCE250/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPIE_example_5.png" alt="Pie chart of AgeCHDdiag in SASHELP.HEART" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Pie chart of AgeCHDdiag in SASHELP.HEART&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2020 20:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Pie-Chart-Slice-Colors/m-p/625138#M19482</guid>
      <dc:creator>SuzanneDorinski</dc:creator>
      <dc:date>2020-02-16T20:38:42Z</dc:date>
    </item>
  </channel>
</rss>

