<?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: Format percentage values in PIE chart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14673#M287</link>
    <description>Hi:&lt;BR /&gt;
  One way, without using ANNOTATE to format the percent, is to "precalculate" the percent and either use a PERCENT format to round to one decimal place or multiply your precalculated percent by 100 and then use a PICTURE format. This means that you will need to use the SUMVAR= option instead of TYPE=PERCENT.&lt;BR /&gt;
 &lt;BR /&gt;
  See the code below, which uses a dataset created by PROC REPORT (although you could have used other procedures) from SASHELP.CLASS.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
title;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
                                    &lt;BR /&gt;
proc report data=sashelp.class nowd out=work.ageout;&lt;BR /&gt;
  column age n pctn mypct;&lt;BR /&gt;
define age /group 'Age';&lt;BR /&gt;
define n / 'Count';&lt;BR /&gt;
define pctn / 'Percent';&lt;BR /&gt;
define mypct/computed;&lt;BR /&gt;
compute mypct;&lt;BR /&gt;
   mypct = round(100*pctn,.1);&lt;BR /&gt;
endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
proc print data=work.ageout;&lt;BR /&gt;
run;&lt;BR /&gt;
                                    &lt;BR /&gt;
proc gchart data=ageout;&lt;BR /&gt;
  Title '1) Use WORK.AGEOUT, PCTN var, PERCENT Format and NOHEADING option';&lt;BR /&gt;
  pie age / discrete type=sum sumvar=pctn noheading;&lt;BR /&gt;
  format pctn percent8.1;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
             &lt;BR /&gt;
proc format;&lt;BR /&gt;
  picture mypc low-high="009.9%";&lt;BR /&gt;
run;&lt;BR /&gt;
                              &lt;BR /&gt;
proc gchart data=ageout;&lt;BR /&gt;
  Title '2) Use WORK.AGEOUT, MYPCT var, Picture Format and NOHEADING option';&lt;BR /&gt;
  pie age / discrete type=sum sumvar=mypct noheading;&lt;BR /&gt;
  format mypct mypc.;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
                 &lt;BR /&gt;
** Original Using SASHELP.CLASS;&lt;BR /&gt;
proc gchart data=sashelp.class;&lt;BR /&gt;
  title '3) Use SASHELP.CLASS, TYPE=PERCENT, Compare to Previous';&lt;BR /&gt;
  pie age / discrete type=percent noheading;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;[/pre]</description>
    <pubDate>Tue, 22 Feb 2011 17:12:22 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2011-02-22T17:12:22Z</dc:date>
    <item>
      <title>Format percentage values in PIE chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14670#M284</link>
      <description>How do i format percetage values in a pie chart produced using gchart procedure.&lt;BR /&gt;
&lt;BR /&gt;
I need to format the percentage value of each pie with one decimal place.I found "detail_percent" option, but could not achieve much success with that.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
karthik</description>
      <pubDate>Tue, 22 Feb 2011 10:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14670#M284</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-22T10:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Format percentage values in PIE chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14671#M285</link>
      <description>Hello, &lt;BR /&gt;
as the only options available for detail_percent are best or none &lt;BR /&gt;
you must write it by your own througth   an annotate&lt;BR /&gt;
&lt;BR /&gt;
Andre</description>
      <pubDate>Tue, 22 Feb 2011 11:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14671#M285</guid>
      <dc:creator>Andre</dc:creator>
      <dc:date>2011-02-22T11:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Format percentage values in PIE chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14672#M286</link>
      <description>Thanks Andre i was thinking on the same lines.</description>
      <pubDate>Tue, 22 Feb 2011 12:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14672#M286</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-22T12:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Format percentage values in PIE chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14673#M287</link>
      <description>Hi:&lt;BR /&gt;
  One way, without using ANNOTATE to format the percent, is to "precalculate" the percent and either use a PERCENT format to round to one decimal place or multiply your precalculated percent by 100 and then use a PICTURE format. This means that you will need to use the SUMVAR= option instead of TYPE=PERCENT.&lt;BR /&gt;
 &lt;BR /&gt;
  See the code below, which uses a dataset created by PROC REPORT (although you could have used other procedures) from SASHELP.CLASS.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
title;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
                                    &lt;BR /&gt;
proc report data=sashelp.class nowd out=work.ageout;&lt;BR /&gt;
  column age n pctn mypct;&lt;BR /&gt;
define age /group 'Age';&lt;BR /&gt;
define n / 'Count';&lt;BR /&gt;
define pctn / 'Percent';&lt;BR /&gt;
define mypct/computed;&lt;BR /&gt;
compute mypct;&lt;BR /&gt;
   mypct = round(100*pctn,.1);&lt;BR /&gt;
endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
proc print data=work.ageout;&lt;BR /&gt;
run;&lt;BR /&gt;
                                    &lt;BR /&gt;
proc gchart data=ageout;&lt;BR /&gt;
  Title '1) Use WORK.AGEOUT, PCTN var, PERCENT Format and NOHEADING option';&lt;BR /&gt;
  pie age / discrete type=sum sumvar=pctn noheading;&lt;BR /&gt;
  format pctn percent8.1;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
             &lt;BR /&gt;
proc format;&lt;BR /&gt;
  picture mypc low-high="009.9%";&lt;BR /&gt;
run;&lt;BR /&gt;
                              &lt;BR /&gt;
proc gchart data=ageout;&lt;BR /&gt;
  Title '2) Use WORK.AGEOUT, MYPCT var, Picture Format and NOHEADING option';&lt;BR /&gt;
  pie age / discrete type=sum sumvar=mypct noheading;&lt;BR /&gt;
  format mypct mypc.;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
                 &lt;BR /&gt;
** Original Using SASHELP.CLASS;&lt;BR /&gt;
proc gchart data=sashelp.class;&lt;BR /&gt;
  title '3) Use SASHELP.CLASS, TYPE=PERCENT, Compare to Previous';&lt;BR /&gt;
  pie age / discrete type=percent noheading;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;[/pre]</description>
      <pubDate>Tue, 22 Feb 2011 17:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Format-percentage-values-in-PIE-chart/m-p/14673#M287</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-22T17:12:22Z</dc:date>
    </item>
  </channel>
</rss>

