<?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 GBARLINE - align pattern of segmented bar with plot? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/GBARLINE-align-pattern-of-segmented-bar-with-plot/m-p/191713#M7089</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running SAS 9.03.01M2P081512.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I subgroup a bar on GBARLINE I can dictate the segment appearance using multiple PATTERN statements.&amp;nbsp;&amp;nbsp; However, in conjunction with multiple PLOT statements how can I align the pattern of the line with the relevant bar segment so that the legend is applicable to both the bar and the line?&amp;nbsp;&amp;nbsp; I'm happy to deviate from GBARLINE to achieve the desired results if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example below is amended from &lt;A href="http://support.sas.com/kb/33/171.html" title="http://support.sas.com/kb/33/171.html"&gt;33171 - Use PROC GBARLINE to create subgrouped bars&lt;/A&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp; I would like the lines (PLOT) for Male and female height to match the legend for the bar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; /* Set the graphics environment */&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;goptions reset=all cback=white border htitle=12pt htext=10pt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;axis1 label=('Frequency of Age') minor=none; &lt;/P&gt;&lt;P&gt;axis2 label=('Sum of Height') minor=none;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;symbol1 i=join c=black v=dot h=1.3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;legend1 label=('Gender') value=('Female' 'Male') frame;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pattern1 v=solid c=CXDE7E6F;&lt;/P&gt;&lt;P&gt;pattern2 v=solid c=CX7C95CA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title1 'Using the SUBGROUP option with PROC GBARLINE';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.class_demo;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;if sex='M' then height_m=height;&lt;/P&gt;&lt;P&gt;if sex='F' then height_f=height;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; /* Create the graph using the SUBGROUP= option */&lt;/P&gt;&lt;P&gt; /* on the BAR statement&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;proc gbarline data= work.class_demo;&lt;/P&gt;&lt;P&gt;&amp;nbsp; bar age / subgroup=sex legend=legend1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; discrete raxis=axis1&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;width=10;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; plot / sumvar= height_m&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;raxis=axis2;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;plot / sumvar= height_f&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;raxis=axis2 ;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jan 2015 14:37:16 GMT</pubDate>
    <dc:creator>RB1Kenobi</dc:creator>
    <dc:date>2015-01-21T14:37:16Z</dc:date>
    <item>
      <title>GBARLINE - align pattern of segmented bar with plot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GBARLINE-align-pattern-of-segmented-bar-with-plot/m-p/191713#M7089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running SAS 9.03.01M2P081512.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I subgroup a bar on GBARLINE I can dictate the segment appearance using multiple PATTERN statements.&amp;nbsp;&amp;nbsp; However, in conjunction with multiple PLOT statements how can I align the pattern of the line with the relevant bar segment so that the legend is applicable to both the bar and the line?&amp;nbsp;&amp;nbsp; I'm happy to deviate from GBARLINE to achieve the desired results if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example below is amended from &lt;A href="http://support.sas.com/kb/33/171.html" title="http://support.sas.com/kb/33/171.html"&gt;33171 - Use PROC GBARLINE to create subgrouped bars&lt;/A&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp; I would like the lines (PLOT) for Male and female height to match the legend for the bar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; /* Set the graphics environment */&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;goptions reset=all cback=white border htitle=12pt htext=10pt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;axis1 label=('Frequency of Age') minor=none; &lt;/P&gt;&lt;P&gt;axis2 label=('Sum of Height') minor=none;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;symbol1 i=join c=black v=dot h=1.3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;legend1 label=('Gender') value=('Female' 'Male') frame;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pattern1 v=solid c=CXDE7E6F;&lt;/P&gt;&lt;P&gt;pattern2 v=solid c=CX7C95CA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title1 'Using the SUBGROUP option with PROC GBARLINE';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.class_demo;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;if sex='M' then height_m=height;&lt;/P&gt;&lt;P&gt;if sex='F' then height_f=height;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; /* Create the graph using the SUBGROUP= option */&lt;/P&gt;&lt;P&gt; /* on the BAR statement&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;proc gbarline data= work.class_demo;&lt;/P&gt;&lt;P&gt;&amp;nbsp; bar age / subgroup=sex legend=legend1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; discrete raxis=axis1&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;width=10;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp; plot / sumvar= height_m&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;raxis=axis2;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;plot / sumvar= height_f&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;raxis=axis2 ;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 14:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GBARLINE-align-pattern-of-segmented-bar-with-plot/m-p/191713#M7089</guid>
      <dc:creator>RB1Kenobi</dc:creator>
      <dc:date>2015-01-21T14:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: GBARLINE - align pattern of segmented bar with plot?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GBARLINE-align-pattern-of-segmented-bar-with-plot/m-p/191714#M7090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using SYMBOL statements seems to work, although this example needs a bit of refinement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;symbol2&amp;nbsp; c=CXDE7E6F interpol=box co=black;&lt;/P&gt;&lt;P&gt;symbol1&amp;nbsp; c=CX7C95CA interpol=box co=black&amp;nbsp; ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jan 2015 15:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GBARLINE-align-pattern-of-segmented-bar-with-plot/m-p/191714#M7090</guid>
      <dc:creator>RB1Kenobi</dc:creator>
      <dc:date>2015-01-21T15:07:17Z</dc:date>
    </item>
  </channel>
</rss>

