<?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 Help formatting gchart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73585#M2676</link>
    <description>I almost have my hbar chart where I need it to be, with the following exceptions:&lt;BR /&gt;
&lt;BR /&gt;
1) My bars are "stacked" using a subgroup variable - I have each subroup labeled with its percent value. However, I cannot figure out how to get the percent value centered within its area of the bar. Here is the code used to label the subgroups - I have the code "annotate=barlabel" as an option in my hbar statement:&lt;BR /&gt;
&lt;BR /&gt;
data barlabel;  length color style $ 8; retain color 'black' when 'a' style 'swissb'      xsys ysys '2' position '&lt;I&gt;[less than sign]&lt;/I&gt;' size 2 hsys '3'; set stats;&lt;BR /&gt;
	   midpoint=s;&lt;BR /&gt;
	   subgroup=response;&lt;BR /&gt;
	   text=left(put(percent,5.));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
*Note: I needed to indicate the "less than" sign with words above because otherwise it would cut my post short.&lt;BR /&gt;
&lt;BR /&gt;
2) I cannot, for some reason, change the label or values of the vertical axis - I am trying to change the font and use right justify, but nothing happens. Here is the rest of the code I am using:&lt;BR /&gt;
&lt;BR /&gt;
legend1 across=3 shape=bar(3,2) label=none position=(bottom outside center)&lt;BR /&gt;
	 value=(font='arial' h=8pt 'Positive Top 3' 'Neutral Middle 3' 'Negative Bottom 3');&lt;BR /&gt;
proc format; picture pctfmt (round) 0-high='000%'; run;&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data=stats;&lt;BR /&gt;
axis1 order=(0 to 100 by 10) minor=(n=1) label=none value=(font='arial' height=8pt);&lt;BR /&gt;
axis2 label=(font='arial' height=8pt justify=right) value=(font='arial' height=8pt );&lt;BR /&gt;
hbar s/discrete sumvar=percent subgroup=response type=sum nostats width=3&lt;BR /&gt;
	vref=100 coutline=black frame raxis=axis1 legend=legend1 annotate=barlabel;&lt;BR /&gt;
format percent pctfmt.;&lt;BR /&gt;
run; quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If anyone has any suggestions, I would be extremely grateful.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance!</description>
    <pubDate>Mon, 28 Sep 2009 21:15:21 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-09-28T21:15:21Z</dc:date>
    <item>
      <title>Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73585#M2676</link>
      <description>I almost have my hbar chart where I need it to be, with the following exceptions:&lt;BR /&gt;
&lt;BR /&gt;
1) My bars are "stacked" using a subgroup variable - I have each subroup labeled with its percent value. However, I cannot figure out how to get the percent value centered within its area of the bar. Here is the code used to label the subgroups - I have the code "annotate=barlabel" as an option in my hbar statement:&lt;BR /&gt;
&lt;BR /&gt;
data barlabel;  length color style $ 8; retain color 'black' when 'a' style 'swissb'      xsys ysys '2' position '&lt;I&gt;[less than sign]&lt;/I&gt;' size 2 hsys '3'; set stats;&lt;BR /&gt;
	   midpoint=s;&lt;BR /&gt;
	   subgroup=response;&lt;BR /&gt;
	   text=left(put(percent,5.));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
*Note: I needed to indicate the "less than" sign with words above because otherwise it would cut my post short.&lt;BR /&gt;
&lt;BR /&gt;
2) I cannot, for some reason, change the label or values of the vertical axis - I am trying to change the font and use right justify, but nothing happens. Here is the rest of the code I am using:&lt;BR /&gt;
&lt;BR /&gt;
legend1 across=3 shape=bar(3,2) label=none position=(bottom outside center)&lt;BR /&gt;
	 value=(font='arial' h=8pt 'Positive Top 3' 'Neutral Middle 3' 'Negative Bottom 3');&lt;BR /&gt;
proc format; picture pctfmt (round) 0-high='000%'; run;&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data=stats;&lt;BR /&gt;
axis1 order=(0 to 100 by 10) minor=(n=1) label=none value=(font='arial' height=8pt);&lt;BR /&gt;
axis2 label=(font='arial' height=8pt justify=right) value=(font='arial' height=8pt );&lt;BR /&gt;
hbar s/discrete sumvar=percent subgroup=response type=sum nostats width=3&lt;BR /&gt;
	vref=100 coutline=black frame raxis=axis1 legend=legend1 annotate=barlabel;&lt;BR /&gt;
format percent pctfmt.;&lt;BR /&gt;
run; quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If anyone has any suggestions, I would be extremely grateful.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance!</description>
      <pubDate>Mon, 28 Sep 2009 21:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73585#M2676</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-28T21:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73586#M2677</link>
      <description>What version of SAS are you using?</description>
      <pubDate>Mon, 28 Sep 2009 21:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73586#M2677</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2009-09-28T21:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73587#M2678</link>
      <description>SAS 9.1</description>
      <pubDate>Tue, 29 Sep 2009 12:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73587#M2678</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-29T12:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73588#M2679</link>
      <description>I modified your test to use sashelp.class, just as an example.  The key do doing what you want is to use proc summary to pre-compute your data and use X and Y in the annotate dataset instead of MIDPOINT and SUBGROUP.  That way, you can compute the label locations based on the summarized data.  Here the example:&lt;BR /&gt;
&lt;BR /&gt;
proc summary data=sashelp.class nway;&lt;BR /&gt;
class age sex;&lt;BR /&gt;
var height;&lt;BR /&gt;
output out=class sum=;&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
data barlabel;  &lt;BR /&gt;
length color style $ 8; &lt;BR /&gt;
retain color 'black' &lt;BR /&gt;
       when 'a' &lt;BR /&gt;
       style 'swissb'      &lt;BR /&gt;
       xsys ysys '2' &lt;BR /&gt;
       position '4' &lt;BR /&gt;
       size 2 &lt;BR /&gt;
       hsys '3'&lt;BR /&gt;
	   previous 0;&lt;BR /&gt;
set class;&lt;BR /&gt;
by age;&lt;BR /&gt;
	   y=age;&lt;BR /&gt;
	   x=previous+(height/2);&lt;BR /&gt;
	   if (last.age) then previous=0;&lt;BR /&gt;
	   else previous=previous+height;&lt;BR /&gt;
	   text=left(put(height,5.));&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=barlabel; run;&lt;BR /&gt;
&lt;BR /&gt;
legend1 across=3 shape=bar(3,2) label=none position=(bottom outside center)&lt;BR /&gt;
	 value=(font='arial' h=8pt 'Positive Top 3' 'Neutral Middle 3' 'Negative Bottom 3'); &lt;BR /&gt;
&lt;BR /&gt;
proc format; picture pctfmt (round) 0-high='000%'; run;&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data=sashelp.class;&lt;BR /&gt;
axis1 /* order=(0 to 100 by 10) */ minor=(n=1) label=none value=(font='arial' height=8pt);&lt;BR /&gt;
axis2 label=(font='arial' height=8pt justify=right) value=(font='arial' height=8pt ); &lt;BR /&gt;
hbar age/discrete sumvar=height subgroup=sex type=sum nostats width=3&lt;BR /&gt;
	vref=100 coutline=black frame raxis=axis1 legend=legend1 annotate=barlabel; &lt;BR /&gt;
run; quit;</description>
      <pubDate>Tue, 29 Sep 2009 17:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73588#M2679</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2009-09-29T17:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73589#M2680</link>
      <description>Dan, I can't thank you enough for your reply. I now have the labels centered on the corresponding bars. &lt;BR /&gt;
&lt;BR /&gt;
However, I am running into a problem because my variable that is like "age" in your example is a categorical variable and I can't figure out how to label it with words. It has to be numerical to make your solution to the centered numbers work.&lt;BR /&gt;
&lt;BR /&gt;
There must be something wrong with my axis code?&lt;BR /&gt;
&lt;BR /&gt;
What is the vertical axis on my horizontal bar chart called? Is there a way to format the numbers to words? I apologize if I am not explaining this clearly...&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Tue, 29 Sep 2009 18:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73589#M2680</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-29T18:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73590#M2681</link>
      <description>If your midpoint data is strings, create a numeric column that assigns a numbers to the strings.  Then, create a user-defined format that maps the numbers back to strings. Use the numeric column in the datastep and in the gchart procedure, using a FORMAT statement in the GCHART procedure to assign the format to your numeric column.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Dan</description>
      <pubDate>Tue, 29 Sep 2009 19:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73590#M2681</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2009-09-29T19:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help formatting gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73591#M2682</link>
      <description>Dan - thank you so much for your help!</description>
      <pubDate>Thu, 01 Oct 2009 12:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Help-formatting-gchart/m-p/73591#M2682</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-01T12:48:28Z</dc:date>
    </item>
  </channel>
</rss>

