<?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: Annotate a SGplot with 100% percent stack bars in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698669#M20722</link>
    <description>&lt;P&gt;Run the code below. If you want to bring the text down a little, add some OFFSETMAX to the YAXIS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data anno;
retain x1space "datavalue" y1space "datapercent" y1 102 function "text" width 40;
input xc1 $ label $;
cards;
American 134889
National 105866
;
run;

 title "sashelp.Baseball";
 proc sgplot data=sashelp.baseball noborder pctlevel=group sganno=anno;
 styleattrs datacolors=(DarkBlue LightBlue bip ) ;
   vbar league / response=crhits stat=percent nostatlabel group=division        
            missing seglabel /*datalabel*/ nooutline datalabelattrs=(size=10)
 	    seglabelattrs=(color=white size=10 weight=bold);
   xaxis display=(nolabel noline noticks);
   yaxis display=(noline noticks) grid;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Nov 2020 14:32:40 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2020-11-13T14:32:40Z</dc:date>
    <item>
      <title>Annotate a SGplot with 100% percent stack bars</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698648#M20721</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I need some help with SGplot. I would like to have a 100% stacked bar chart with a datalabel on top showing the value, not 100%.&lt;/P&gt;&lt;P&gt;I have my 100% stacked bar chart - but if I add datalabel, then I get the value "100%".&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "sashelp.Baseball";
proc sgplot data=sashelp.baseball noborder pctlevel=group;
styleattrs datacolors=(DarkBlue LightBlue bip ) ;
  vbar league / response=crhits stat=percent nostatlabel
       group=division missing seglabel /*datalabel*/ nooutline datalabelattrs=(size=10)
	seglabelattrs=(color=white size=10 weight=bold);
  xaxis display=(nolabel noline noticks);
  yaxis display=(noline noticks) grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stacked_100%.JPG" style="width: 657px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51635i1F7387D1EC1A8CD0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Stacked_100%.JPG" alt="Stacked_100%.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The stacked bar chart with value - highlighted in yellow on the picture.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sashelp.baseball noborder ;
styleattrs datacolors=(DarkBlue LightBlue bip ) ;
  vbar league / response=crhits stat=sum nostatlabel
       group=division missing seglabel datalabel nooutline datalabelattrs=(size=10)
	seglabelattrs=(color=white size=10 weight=bold);
  xaxis display=(nolabel noline noticks);
  yaxis display=(noline noticks) grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stacked_with_value.JPG" style="width: 657px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51636i5A1C6A6F14AB877F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Stacked_with_value.JPG" alt="Stacked_with_value.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I get the value to the 100% stacked bar chart?&lt;/P&gt;&lt;P&gt;My guess is some form of annotate, but I need some help.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;Steffen&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 13:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698648#M20721</guid>
      <dc:creator>SteffenRannes</dc:creator>
      <dc:date>2020-11-13T13:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Annotate a SGplot with 100% percent stack bars</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698669#M20722</link>
      <description>&lt;P&gt;Run the code below. If you want to bring the text down a little, add some OFFSETMAX to the YAXIS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data anno;
retain x1space "datavalue" y1space "datapercent" y1 102 function "text" width 40;
input xc1 $ label $;
cards;
American 134889
National 105866
;
run;

 title "sashelp.Baseball";
 proc sgplot data=sashelp.baseball noborder pctlevel=group sganno=anno;
 styleattrs datacolors=(DarkBlue LightBlue bip ) ;
   vbar league / response=crhits stat=percent nostatlabel group=division        
            missing seglabel /*datalabel*/ nooutline datalabelattrs=(size=10)
 	    seglabelattrs=(color=white size=10 weight=bold);
   xaxis display=(nolabel noline noticks);
   yaxis display=(noline noticks) grid;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Nov 2020 14:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698669#M20722</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2020-11-13T14:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Annotate a SGplot with 100% percent stack bars</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698677#M20723</link>
      <description>&lt;P&gt;Or use PROC MEANS or PROC FREQ to summarize the data and use VBARPARM and TEXT statements to display the bars and labels.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 14:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/698677#M20723</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-11-13T14:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Annotate a SGplot with 100% percent stack bars</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/699060#M20730</link>
      <description>&lt;P&gt;Thanks. It works just fine.&lt;/P&gt;&lt;P&gt;I changed the data step creating the anno data to be more datadriven, but I got the basic idear &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table anno as
select
League as xc1
,put(sum(crhits), commax12.) as label
,"datavalue" as x1space 
,"datapercent" as y1space 
,102 as y1 
,"text" as function 
,40 as width 
from sashelp.baseball
group by League
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2020 08:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Annotate-a-SGplot-with-100-percent-stack-bars/m-p/699060#M20730</guid>
      <dc:creator>SteffenRannes</dc:creator>
      <dc:date>2020-11-16T08:14:04Z</dc:date>
    </item>
  </channel>
</rss>

