<?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: PROC GCHART: formatting data labels inside stacked bar chart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510643#M17352</link>
    <description>FYI - I've moved your post to the graphics forum so the right people will see it. Regarding your previous post, please make sure to look at the dates. That one happens to be from 2009 and the only people who would likely see it are those who initially responded then, assuming they're still active on the community.</description>
    <pubDate>Mon, 05 Nov 2018 23:18:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-05T23:18:27Z</dc:date>
    <item>
      <title>PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510595#M17349</link>
      <description>&lt;P&gt;I'm trying to get percentages inside a stacked bar chart, but they come out to two decimal places and I just need one.&amp;nbsp; (Note:&amp;nbsp; I had originally posted a version of this in this topic, but didn't get a response, so am posting it here):&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/proc-gchart-format-inside-subpct/td-p/25122" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/proc-gchart-format-inside-subpct/td-p/25122&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here're my data and code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 359px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24511iB5CA5893879CC863/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Figure 6:  Coalition Progress on Individual Activities (All Coalitions)*/
title1 "Progress on Individual Activities (All Coalitions)";
axis1 label=("Activity") value=(angle=45 rotate=0);
axis2 label=none value=none;
axis3 label=(angle=90 "Percent") value=("0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "80%" "90%" "100%") 
	minor=none;
PROC GCHART data=temp;
	format prog1 prog.;
	vbar count / type=percent subgroup=prog1 g100 group=Activity inside=pct
	gaxis=axis1 maxis=axis2 raxis=axis3 width=20;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this graph, which is very nearly what I need, just that the two decimal points give an impression of a great precision that just isn't in the data!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24513iEB9A958ADE978842/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture2.png" alt="Picture2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I quickly and easily get the data labels to just one decimal point?&amp;nbsp; Is there anything like the "maxdec" option?&amp;nbsp; Can I apply a variable format?&amp;nbsp; Do I have to do the complex "anno" procedure recommended recommended in this SAS User Community&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/proc-gchart-format-inside-subpct/td-p/25122" target="_self"&gt;post&lt;/A&gt;?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 21:01:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510595#M17349</guid>
      <dc:creator>dbcrow</dc:creator>
      <dc:date>2018-11-05T21:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510603#M17350</link>
      <description>Have you tried SGPLOT instead?</description>
      <pubDate>Mon, 05 Nov 2018 21:20:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510603#M17350</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-05T21:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510634#M17351</link>
      <description>&lt;P&gt;One of the reasons those sorts of Annotate macros exist is because the older device based graphics did not have options available to format values on bars (among other places in graphs).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also there is not much updating going on for the older graphics procedures because they were based around devices and device files are not always a good way to go for modern document output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So Proc SGplot as the options SEGLABEL to add a label to segments of a vertical or horizontal bar chart, which works with the SEGLABELFORMAT to set the display format for the values displayed on the segment. Other options involve SEGLABELFITPOLICY to help fit values into segments (or not) and SEGLABELATTRS to set the text options like font family, color and size of segment text.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 23:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510634#M17351</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-05T23:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510643#M17352</link>
      <description>FYI - I've moved your post to the graphics forum so the right people will see it. Regarding your previous post, please make sure to look at the dates. That one happens to be from 2009 and the only people who would likely see it are those who initially responded then, assuming they're still active on the community.</description>
      <pubDate>Mon, 05 Nov 2018 23:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510643#M17352</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-05T23:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510649#M17353</link>
      <description>No.</description>
      <pubDate>Mon, 05 Nov 2018 23:35:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510649#M17353</guid>
      <dc:creator>dbcrow</dc:creator>
      <dc:date>2018-11-05T23:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510650#M17354</link>
      <description>&lt;P&gt;Thanks for this detailed advice! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I'll apply it and update you with the results.&amp;nbsp; As I mention below to Reeza, I'm still getting up to speed in SAS, so am not familiar with the program's history, commands (oops, procedures!), &amp;amp;c., so I appreciate the explanation on annotate, and on the newer graphics procedures.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 23:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510650#M17354</guid>
      <dc:creator>dbcrow</dc:creator>
      <dc:date>2018-11-05T23:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510651#M17355</link>
      <description>Thanks, Reeza. I'm relatively new to SAS, and very new to the SAS community, so I appreciate the advice on getting posts to the correct forum. Of course, looking at dates of posts in *any* forum is *always* good advice. My bad. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 05 Nov 2018 23:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510651#M17355</guid>
      <dc:creator>dbcrow</dc:creator>
      <dc:date>2018-11-05T23:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510661#M17356</link>
      <description>&lt;P&gt;I now remember the reason I used PROC GCHART:&amp;nbsp; the handy "g100" option to ensure that the percentages sum to 100% within each column.&amp;nbsp; My data are frequency counts ("count") of a category ("prog1") within another category ("Activity").&amp;nbsp; Here's a screenshot of the data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Picture1.png" style="width: 435px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24701i021FA999156FE459/image-size/large?v=v2&amp;amp;px=999" role="button" title="Picture1.png" alt="Picture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Figure 6:  Coalition Progress on Individual Activities (All Coalitions)*/
ods listing gpath="H:\Coalitions\";
ods graphics on / imagename="figure6" reset=index;
title1 "Figure 6. Progress by Individual Activities (All Coalitions)";
PROC SGPLOT data=temp2;
	format prog1 prog.;
	vbar Activity / response=count group=prog1 groupdisplay=stack seglabel;
	xaxis label="Activity";
	yaxis label="Percentage of Total for Each Activity";
RUN; 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Produces this graphic:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="figure61.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24702i539DBC41B240D1AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="figure61.png" alt="figure61.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which is farther from what I want than the graphic I produced with PROC GCHART.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like the options I have are:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(1) doing more (or different) data pre-processing to get percentages in the "count" variables in the above data (e.g., the first cell in the count column would be 1/23 = 4.3), then getting the seglabel and segformat options to put in data labels with percent signs, or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(2) using the "annotate" statement with the "g100" option of PROC GCHART.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first option is probably easier, but isn't their something yet easier--the equivalent of "g100" for PROC SGPLOT?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your patience,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Nov 2018 01:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510661#M17356</guid>
      <dc:creator>dbcrow</dc:creator>
      <dc:date>2018-11-06T01:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510664#M17357</link>
      <description>Try changing STAT to percent and specify the FREQ option with the count. Or see here : &lt;A href="https://blogs.sas.com/content/iml/2014/04/08/construct-a-stacked-bar-chart-in-sas-where-each-bar-equals-100.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2014/04/08/construct-a-stacked-bar-chart-in-sas-where-each-bar-equals-100.html&lt;/A&gt;</description>
      <pubDate>Tue, 06 Nov 2018 01:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510664#M17357</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-06T01:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GCHART: formatting data labels inside stacked bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510828#M17367</link>
      <description>&lt;P&gt;Pre-summarize the data until SAS add a similar G100&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc freq data=sashelp.class;
   tables sex*age / outpct out=work.classfreq;
run;

Proc sgplot data=work.classfreq;
   vbar sex / group=age response=pct_row 
         seglabel seglabelformat=f2.;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Nov 2018 17:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GCHART-formatting-data-labels-inside-stacked-bar-chart/m-p/510828#M17367</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-06T17:14:55Z</dc:date>
    </item>
  </channel>
</rss>

