<?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: Adding pattern on VBAR statement in PROC SGPLOT in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33754#M4895</link>
    <description>Hi:&lt;BR /&gt;
  I believe that you can change the color of the bar, but not the pattern (at this time). &lt;BR /&gt;
 &lt;BR /&gt;
  To add the number/statistic at the top of the bar, use the datalabel option. To control the colors for a single group, see example #1 (basically, you tell it that the X axis variable is its own group. To control the colors for a grouped bar chart, use a style template, such as that shown in #2.&lt;BR /&gt;
&lt;BR /&gt;
  For more information about style elements, refer to:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003121053.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003121053.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003136924.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003136924.htm&lt;/A&gt;&lt;BR /&gt;
                 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing style=listing;&lt;BR /&gt;
                      &lt;BR /&gt;
proc sort data=sashelp.class out=class;&lt;BR /&gt;
by age sex;&lt;BR /&gt;
run;&lt;BR /&gt;
                            &lt;BR /&gt;
** 1 -- different color each discrete age, by using;&lt;BR /&gt;
**      age as a group;&lt;BR /&gt;
proc sgplot data=class;&lt;BR /&gt;
  title '1) different color each age';&lt;BR /&gt;
  vbar age / datalabel stat=freq group=age;&lt;BR /&gt;
  xaxis label = 'Age' &lt;BR /&gt;
        values=(11 to 16 by 1);&lt;BR /&gt;
  yaxis label = 'Students' values=( 0 to 10 by 1);&lt;BR /&gt;
  format age 2.0;&lt;BR /&gt;
run;&lt;BR /&gt;
                                     &lt;BR /&gt;
** 2 -- control colors for groups using style template;&lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.mystyle;&lt;BR /&gt;
     parent = styles.listing;&lt;BR /&gt;
     class GraphColors /&lt;BR /&gt;
           'gdata1' = purple&lt;BR /&gt;
           'gdata2' = pink;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                                  &lt;BR /&gt;
ods listing style=mystyle;&lt;BR /&gt;
                  &lt;BR /&gt;
proc sgplot data=class;&lt;BR /&gt;
  title '2) different color for each group';&lt;BR /&gt;
  vbar age / datalabel group=sex;&lt;BR /&gt;
  xaxis label = 'Age' fitpolicy=stagger&lt;BR /&gt;
        values=(11 to 16 by 1);&lt;BR /&gt;
  yaxis label = 'Students' values=( 0 to 10 by 1);&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
ods listing style=listing;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Sat, 06 Jun 2009 22:54:01 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2009-06-06T22:54:01Z</dc:date>
    <item>
      <title>Adding pattern on VBAR statement in PROC SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33752#M4893</link>
      <description>I need some help to customized the bar graphs in PROC SGPLOT. &lt;BR /&gt;
&lt;BR /&gt;
Which option shall I use to change the default to pattern and/ or color pattern bar? Can I add the count number on top of each bar? If so, how to do it? I know PROC GCHART could do it but not sure how it might works in SGPLOT. &lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Michael.</description>
      <pubDate>Tue, 19 May 2009 15:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33752#M4893</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-19T15:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding pattern on VBAR statement in PROC SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33753#M4894</link>
      <description>Here's a good starting point with the SAS-hosted documentation references found on the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website:&lt;BR /&gt;
&lt;BR /&gt;
The SGPLOT Procedure&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/sgplot-chap.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/sgplot-chap.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Also, there are SAS technical and conference papers available on the website demonstrating different functions, features and capabilities with SGPLOT, as I found using the Google advanced search argument:&lt;BR /&gt;
&lt;BR /&gt;
sgplot vbar axis site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 25 May 2009 16:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33753#M4894</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-05-25T16:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding pattern on VBAR statement in PROC SGPLOT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33754#M4895</link>
      <description>Hi:&lt;BR /&gt;
  I believe that you can change the color of the bar, but not the pattern (at this time). &lt;BR /&gt;
 &lt;BR /&gt;
  To add the number/statistic at the top of the bar, use the datalabel option. To control the colors for a single group, see example #1 (basically, you tell it that the X axis variable is its own group. To control the colors for a grouped bar chart, use a style template, such as that shown in #2.&lt;BR /&gt;
&lt;BR /&gt;
  For more information about style elements, refer to:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003121053.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003121053.htm&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003136924.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/grstatproc/61948/HTML/default/a003136924.htm&lt;/A&gt;&lt;BR /&gt;
                 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods listing style=listing;&lt;BR /&gt;
                      &lt;BR /&gt;
proc sort data=sashelp.class out=class;&lt;BR /&gt;
by age sex;&lt;BR /&gt;
run;&lt;BR /&gt;
                            &lt;BR /&gt;
** 1 -- different color each discrete age, by using;&lt;BR /&gt;
**      age as a group;&lt;BR /&gt;
proc sgplot data=class;&lt;BR /&gt;
  title '1) different color each age';&lt;BR /&gt;
  vbar age / datalabel stat=freq group=age;&lt;BR /&gt;
  xaxis label = 'Age' &lt;BR /&gt;
        values=(11 to 16 by 1);&lt;BR /&gt;
  yaxis label = 'Students' values=( 0 to 10 by 1);&lt;BR /&gt;
  format age 2.0;&lt;BR /&gt;
run;&lt;BR /&gt;
                                     &lt;BR /&gt;
** 2 -- control colors for groups using style template;&lt;BR /&gt;
proc template;&lt;BR /&gt;
  define style styles.mystyle;&lt;BR /&gt;
     parent = styles.listing;&lt;BR /&gt;
     class GraphColors /&lt;BR /&gt;
           'gdata1' = purple&lt;BR /&gt;
           'gdata2' = pink;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                                  &lt;BR /&gt;
ods listing style=mystyle;&lt;BR /&gt;
                  &lt;BR /&gt;
proc sgplot data=class;&lt;BR /&gt;
  title '2) different color for each group';&lt;BR /&gt;
  vbar age / datalabel group=sex;&lt;BR /&gt;
  xaxis label = 'Age' fitpolicy=stagger&lt;BR /&gt;
        values=(11 to 16 by 1);&lt;BR /&gt;
  yaxis label = 'Students' values=( 0 to 10 by 1);&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
ods listing style=listing;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sat, 06 Jun 2009 22:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Adding-pattern-on-VBAR-statement-in-PROC-SGPLOT/m-p/33754#M4895</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-06-06T22:54:01Z</dc:date>
    </item>
  </channel>
</rss>

