<?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: Plotting Confidence Bands by Group in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309347#M10864</link>
    <description>&lt;P&gt;Thanks, Bruno. This works nicely.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dhrumil&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2016 16:44:23 GMT</pubDate>
    <dc:creator>dhrumil_patel</dc:creator>
    <dc:date>2016-11-04T16:44:23Z</dc:date>
    <item>
      <title>Plotting Confidence Bands by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309160#M10855</link>
      <description>&lt;P&gt;On SAS 9.3, I'm trying to plot the width of a custom confidence interval by year. For each year, I have three groups. Using the graph, I would like to visually inspect the width of the intervals by each group across year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do this by creating a stacked bar chart that uses an associated attribute map. The space from 0 to the lowerRange, I want to fill with white and the space from the lowerRange to the upperRange, I'd like to fill with a non-white color (here, orange). For each year, I'll have three stacked bars, one for each group.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting an error when specifying the same value for the group= option in the VBARPARM statement in PROC SGPLOT.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data conditionData;&lt;/P&gt;&lt;P&gt;length model_year 8. price_type $ 15. grade_2 grade_3 grade_4 8.;&lt;/P&gt;&lt;P&gt;input model_year price_type $ grade_2 grade_3 grade_4;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;2002 &amp;nbsp;lowerRange &amp;nbsp;2300 &amp;nbsp;3600 &amp;nbsp;.&lt;/P&gt;&lt;P&gt;2002 &amp;nbsp;upperRange 3000 &amp;nbsp;4400 &amp;nbsp;.&lt;/P&gt;&lt;P&gt;2003 &amp;nbsp;&lt;SPAN&gt;lowerRange &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4100 &amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2003 &amp;nbsp;&lt;SPAN&gt;upperRange &amp;nbsp;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4900 &amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2004 &amp;nbsp;&lt;SPAN&gt;lowerRange &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5200 &amp;nbsp;6200&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2004 &amp;nbsp;&lt;SPAN&gt;upperRange &amp;nbsp;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6200 &amp;nbsp;7100&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The attribute map I created is here:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data attrmap;
length id $ 15. value $ 20. fillcolor $ 9;
/*retain linecolor "black";*/
input id $ value fillcolor $;
datalines;
grade_2  avg_lowerRange  white
grade_2  avg_upperRange  orange
grade_3  avg_lowerRange  white
grade_3  avg_upperRange  orange
grade_4  avg_lowerRange  white
grade_4  avg_upperRange  orange
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, here is the PROC SGPLOT code where I get the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sgplot data=test_trp dattrmap=attrmap noautolegend;
yaxis label='Auction Price';
vbarparm category=yearproduction response=grade_2 / 
	group=price_type attrid=grade_2
	barwidth=0.2 groupdisplay=stack
	discreteoffset=-0.4;
vbarparm category=yearproduction response=grade_3 / 
	group=price_type attrid=grade_3 
	barwidth=0.2 groupdisplay=stack
	discreteoffset=0;
vbarparm category=yearproduction response=grade_4 / 
	group=price_type attrid=grade_4
	barwidth=0.2 groupdisplay=stack
	discreteoffset=0.4;
run;&lt;/PRE&gt;&lt;P&gt;SAS issues a warning that "only one attribute id can be assigned to the price_type variable." Because of that, the bars for the last two groups are filled with default colors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can correct this? Or another approach altogether?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any suggestions. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dhrumil&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 23:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309160#M10855</guid>
      <dc:creator>dhrumil_patel</dc:creator>
      <dc:date>2016-11-03T23:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Confidence Bands by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309201#M10856</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could create new variables for each VBARPARM statement having the same content. Based on the code you provided, I put together this sample program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test_trp;
  length model_year 8. price_type $ 15. grade_2 grade_3 grade_4 8.;
  input model_year price_type $ grade_2 grade_3 grade_4;
  price_type2 = price_type;
  price_type3 = price_type;
  datalines;
2002  lowerRange  2300  3600  .
2002  upperRange 3000  4400  .
2003  lowerRange   .        4100  .
2003  upperRange  .        4900  .
2004  lowerRange   .        5200  6200
2004  upperRange  .        6200  7100
;

data attrmap;
length id $ 15. value $ 20. fillcolor $ 9;

retain linecolor "black";
input id $ value fillcolor $;
datalines;
grade_2  lowerRange  white
grade_2  upperRange  orange
grade_3  lowerRange  white
grade_3  upperRange  orange
grade_4  lowerRange  white
grade_4  upperRange  orange
;

proc sgplot data=test_trp dattrmap=attrmap noautolegend;
  yaxis label='Auction Price';
  vbarparm category=model_year response=grade_2 / 
    group=price_type attrid=grade_2
    barwidth=0.2 groupdisplay=stack
    discreteoffset=-0.4;
  vbarparm category=model_year response=grade_3 / 
    group=price_type2 attrid=grade_3 
    barwidth=0.2 groupdisplay=stack
    discreteoffset=0;
  vbarparm category=model_year response=grade_4 / 
    group=price_type3 attrid=grade_4
    barwidth=0.2 groupdisplay=stack
    discreteoffset=0.4;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 07:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309201#M10856</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-11-04T07:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Confidence Bands by Group</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309347#M10864</link>
      <description>&lt;P&gt;Thanks, Bruno. This works nicely.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dhrumil&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 16:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Confidence-Bands-by-Group/m-p/309347#M10864</guid>
      <dc:creator>dhrumil_patel</dc:creator>
      <dc:date>2016-11-04T16:44:23Z</dc:date>
    </item>
  </channel>
</rss>

