<?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: How to produce a stacked and grouped bar-graph in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45508#M11975</link>
    <description>Just to make it a little bit clearer how data is structured, here is the data step to produce the new datafile. (The old datafile  is very similar, there is just no column KZ)&lt;BR /&gt;
&lt;BR /&gt;
data GrundlageGrafik;&lt;BR /&gt;
input   datum date12. gruppe $16. stapel KZ $1.;&lt;BR /&gt;
format datum date9.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
'03MAY2009'D 3-5 Tage         248 A&lt;BR /&gt;
'03MAY2009'D 3-5 Tage         124 B&lt;BR /&gt;
'03MAY2009'D 3-5 Tage         24 C&lt;BR /&gt;
'03MAY2009'd 6-8 Tage         177 A&lt;BR /&gt;
'03MAY2009'D 6-8 Tage         88 B&lt;BR /&gt;
'03MAY2009'D 6-8 Tage         17 C&lt;BR /&gt;
'03MAY2009'd Bis 2 Tage       847 A&lt;BR /&gt;
'03MAY2009'D Bis 2 Tage       423 B&lt;BR /&gt;
'03MAY2009'd Bis 2 Tage       84 C&lt;BR /&gt;
'03MAY2009'd Aelter 8 Tage    191 A&lt;BR /&gt;
'03MAY2009'D Aelter 8 Tage    95 B&lt;BR /&gt;
'03MAY2009'd Aelter 8 Tage    19 C&lt;BR /&gt;
'10MAY2009'd 3-5 Tage         427  A&lt;BR /&gt;
'10MAY2009'D 3-5 Tage         213 B&lt;BR /&gt;
'10MAY2009'd 3-5 Tage         42 C&lt;BR /&gt;
'10MAY2009'd 6-8 Tage         27 A&lt;BR /&gt;
'10MAY2009'd 6-8 Tage         136 B&lt;BR /&gt;
'10MAY2009'd 6-8 Tage         27 C&lt;BR /&gt;
'10MAY2009'd Bis 2 Tage       442 A&lt;BR /&gt;
'10MAY2009'd Bis 2 Tage       221 B&lt;BR /&gt;
'10MAY2009'd Bis 2 Tage       44 C&lt;BR /&gt;
'10MAY2009'd Aelter 8 Tage    24 A&lt;BR /&gt;
'10MAY2009'd Aelter 8 Tage    121 B&lt;BR /&gt;
'10MAY2009'd Aelter 8 Tage    24 C&lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 17 Jun 2009 14:04:57 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-06-17T14:04:57Z</dc:date>
    <item>
      <title>How to produce a stacked and grouped bar-graph</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45507#M11974</link>
      <description>Hi anyone,&lt;BR /&gt;
&lt;BR /&gt;
up to now, we have a grouped bar-graph like this:&lt;BR /&gt;
&lt;BR /&gt;
options device=javaimg gunit=pt ftext=swissl cback=white;&lt;BR /&gt;
pattern1 value=solid color=CX113388;&lt;BR /&gt;
pattern2 value=solid color=CX426BB3;&lt;BR /&gt;
legend1 across=1 frame position=(top center outside) label=none value=(justify=center);&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data=work.GrundlageGrafik;&lt;BR /&gt;
    format datum ddmmyyp10.;&lt;BR /&gt;
	vbar datum / sumvar = stapel&lt;BR /&gt;
                     group = gruppe&lt;BR /&gt;
    	             subgroup = datum&lt;BR /&gt;
	             legend = legend1&lt;BR /&gt;
                     patternid = subgroup  sum&lt;BR /&gt;
                     raxis = axis1 maxis = axis2 gaxis = axis3;&lt;BR /&gt;
                     axis1 label=none minor=none;&lt;BR /&gt;
	     axis2 label=none value=(tick=1 '' tick=2 '');&lt;BR /&gt;
	     axis3 label=none order=('Bis 2 Tage' '3-5 Tage' '6-8 Tage' 'Aelter 8 Tage');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Datalines for work.grundlageGrafik are like this:&lt;BR /&gt;
datum:                     gruppe:      	stapel:&lt;BR /&gt;
'03MAY2009'd           3-5 Tage	      827&lt;BR /&gt;
'03MAY2009'd	6-8 Tage	      592&lt;BR /&gt;
'03MAY2009'd	Bis 2 Tage	    2824&lt;BR /&gt;
'03MAY2009'd	Aelter 8 Tage   637&lt;BR /&gt;
'03MAY2009'd	3-5 Tage	     1424&lt;BR /&gt;
'10MAY2009'd	6-8 Tage	      907&lt;BR /&gt;
'10MAY2009'd	Bis 2 Tage	     1475&lt;BR /&gt;
'10MAY2009'd	Aelter 8 Tage   807&lt;BR /&gt;
&lt;BR /&gt;
Now I should produce the same bar-graph, but the bars now stacked into 3 different parts (according to new field KZ). The colour of the stacked parts of one bar could stay all the same and the parts devided by a black or white line. Also, it's possible to have the same colour for the stacked parts, but different patterns. &lt;BR /&gt;
&lt;BR /&gt;
Datelines for the "new" work.GrundlageGrafik are like this:&lt;BR /&gt;
datum:		gruppe:		stapel  KU&lt;BR /&gt;
'03MAY2009'D	3-5 Tage	    248	A&lt;BR /&gt;
'03MAY2009'D	3-5 Tage	    124	B&lt;BR /&gt;
'03MAY2009'D	3-5 Tage	      24	C&lt;BR /&gt;
'03MAY2009'd	6-8 Tage	    177	A&lt;BR /&gt;
'03MAY2009'D	6-8 Tage	      88	B&lt;BR /&gt;
'03MAY2009'D	6-8 Tage	       17	C&lt;BR /&gt;
'03MAY2009'd	Bis 2 Tage	     847	A&lt;BR /&gt;
'03MAY2009'D	Bis 2 Tage	     423	B&lt;BR /&gt;
'03MAY2009'd	Bis 2 Tage	       84	C&lt;BR /&gt;
'03MAY2009'd	Aelter 8 Tage   191	A&lt;BR /&gt;
'03MAY2009'D	Aelter 8 Tage    95	B&lt;BR /&gt;
'03MAY2009'd	Aelter 8 Tage    19	C&lt;BR /&gt;
'10MAY2009'd	3-5 Tage	    427	A&lt;BR /&gt;
'10MAY2009'D	3-5 Tage	    213	B&lt;BR /&gt;
'10MAY2009'd	3-5 Tage	      42	C&lt;BR /&gt;
'10MAY2009'd	6-8 Tage	       27	A&lt;BR /&gt;
'10MAY2009'd	6-8 Tage	     136	B&lt;BR /&gt;
'10MAY2009'd	6-8 Tage	       27	C&lt;BR /&gt;
'10MAY2009'd	Bis 2 Tage	     442	A&lt;BR /&gt;
'10MAY2009'd	Bis 2 Tage	     221	B&lt;BR /&gt;
'10MAY2009'd	Bis 2 Tage	       44	C&lt;BR /&gt;
'10MAY2009'd	Aelter 8 Tage    24	A&lt;BR /&gt;
'10MAY2009'd	Aelter 8 Tage   121	B&lt;BR /&gt;
'10MAY2009'd	Aelter 8 Tage     24	C&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Does anyone know, whether such a graph type is generally possible and if yes, how to code?&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot for any advice!&lt;BR /&gt;
Sonni</description>
      <pubDate>Wed, 17 Jun 2009 13:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45507#M11974</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-17T13:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to produce a stacked and grouped bar-graph</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45508#M11975</link>
      <description>Just to make it a little bit clearer how data is structured, here is the data step to produce the new datafile. (The old datafile  is very similar, there is just no column KZ)&lt;BR /&gt;
&lt;BR /&gt;
data GrundlageGrafik;&lt;BR /&gt;
input   datum date12. gruppe $16. stapel KZ $1.;&lt;BR /&gt;
format datum date9.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
'03MAY2009'D 3-5 Tage         248 A&lt;BR /&gt;
'03MAY2009'D 3-5 Tage         124 B&lt;BR /&gt;
'03MAY2009'D 3-5 Tage         24 C&lt;BR /&gt;
'03MAY2009'd 6-8 Tage         177 A&lt;BR /&gt;
'03MAY2009'D 6-8 Tage         88 B&lt;BR /&gt;
'03MAY2009'D 6-8 Tage         17 C&lt;BR /&gt;
'03MAY2009'd Bis 2 Tage       847 A&lt;BR /&gt;
'03MAY2009'D Bis 2 Tage       423 B&lt;BR /&gt;
'03MAY2009'd Bis 2 Tage       84 C&lt;BR /&gt;
'03MAY2009'd Aelter 8 Tage    191 A&lt;BR /&gt;
'03MAY2009'D Aelter 8 Tage    95 B&lt;BR /&gt;
'03MAY2009'd Aelter 8 Tage    19 C&lt;BR /&gt;
'10MAY2009'd 3-5 Tage         427  A&lt;BR /&gt;
'10MAY2009'D 3-5 Tage         213 B&lt;BR /&gt;
'10MAY2009'd 3-5 Tage         42 C&lt;BR /&gt;
'10MAY2009'd 6-8 Tage         27 A&lt;BR /&gt;
'10MAY2009'd 6-8 Tage         136 B&lt;BR /&gt;
'10MAY2009'd 6-8 Tage         27 C&lt;BR /&gt;
'10MAY2009'd Bis 2 Tage       442 A&lt;BR /&gt;
'10MAY2009'd Bis 2 Tage       221 B&lt;BR /&gt;
'10MAY2009'd Bis 2 Tage       44 C&lt;BR /&gt;
'10MAY2009'd Aelter 8 Tage    24 A&lt;BR /&gt;
'10MAY2009'd Aelter 8 Tage    121 B&lt;BR /&gt;
'10MAY2009'd Aelter 8 Tage    24 C&lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 17 Jun 2009 14:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45508#M11975</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-17T14:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to produce a stacked and grouped bar-graph</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45509#M11976</link>
      <description>Not sure about what your aiming to do, but, to stack KZ, you should use the SUBGROUP options. The following modification will suffice.&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data=work.GrundlageGrafik;&lt;BR /&gt;
format datum ddmmyyp10.;&lt;BR /&gt;
vbar datum / sumvar = stapel&lt;BR /&gt;
group = gruppe&lt;BR /&gt;
subgroup = KZ /* datum */&lt;BR /&gt;
legend = legend1&lt;BR /&gt;
patternid = subgroup sum&lt;BR /&gt;
raxis = axis1 maxis = axis2 gaxis = axis3;&lt;BR /&gt;
axis1 label=none minor=none;&lt;BR /&gt;
axis2 label=none value=(tick=1 '' tick=2 '');&lt;BR /&gt;
axis3 label=none order=('Bis 2 Tage' '3-5 Tage' '6-8 Tage' 'Aelter 8 Tage');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
GROUP, will combine categories and SUBGROUP will stack values.&lt;BR /&gt;
&lt;BR /&gt;
Is this what you want?&lt;BR /&gt;
&lt;BR /&gt;
Check the online documentation for SAS Graph in particular for the gchart procedure:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/onlinedoc/graph/index.html" target="_blank"&gt;http://support.sas.com/documentation/onlinedoc/graph/index.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
And give a look at the sample gallery:&lt;BR /&gt;
&lt;A href="http://support.sas.com/sassamples/graphgallery/index.html" target="_blank"&gt;http://support.sas.com/sassamples/graphgallery/index.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Wed, 17 Jun 2009 15:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-produce-a-stacked-and-grouped-bar-graph/m-p/45509#M11976</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-06-17T15:16:47Z</dc:date>
    </item>
  </channel>
</rss>

