<?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 Create an Annotated Cluster Bar Plot Using SGPLOT in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598294#M18998</link>
    <description>&lt;P&gt;Yes, this can be done. There are two keys to to placing the arrows correctly:&lt;/P&gt;
&lt;P&gt;1. Use the category data value to find the primary position long the axis for the arrows.&lt;/P&gt;
&lt;P&gt;2. Use DISCRETEOFFSET to offset the ARROWS left or right of that data position.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if you need more explanation.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Oct 2019 14:22:49 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2019-10-22T14:22:49Z</dc:date>
    <item>
      <title>How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598281#M18996</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While looking for a way to graphically present results from McNemar's test, I found the attached figure (from &lt;A href="https://fmcna.com/insights/white-papers/effectiveness-velphoro-patients-chronic-dialysis/" target="_blank"&gt;https://fmcna.com/insights/white-papers/effectiveness-velphoro-patients-chronic-dialysis/&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to make this plot in Unix SAS v9.4 (TS1M5)? I thought it would be easy enough - create a cluster bar plot using precomputed data (to ensure the proper denominator is used) and an annotated dataset for the arrows and text. However, it has proven much more difficult than that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could not figure out how to use pre-computed proportions in the vbarparm statement to make the simple bar plot nor how to generate coordinates for the arrows/text in the annotated dataset given the xaxis is categorical and clustered.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone offer assistance? I'd greatly appreciate it!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Amanda&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 22:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598281#M18996</guid>
      <dc:creator>Awesome1</dc:creator>
      <dc:date>2019-10-21T22:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598293#M18997</link>
      <description>&lt;P&gt;I suggest this can be made by layering a HighLow plot (TYPE=LINE) over a Cluster Grouped VBARPARM.&amp;nbsp; This will get you 99% there using a cluster grouped HighLow with LOWCAP, HIGHCAP and HIGHLABEL options.&amp;nbsp; For the HighLow, the blue group values can be missing.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 00:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598293#M18997</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2019-10-22T00:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598294#M18998</link>
      <description>&lt;P&gt;Yes, this can be done. There are two keys to to placing the arrows correctly:&lt;/P&gt;
&lt;P&gt;1. Use the category data value to find the primary position long the axis for the arrows.&lt;/P&gt;
&lt;P&gt;2. Use DISCRETEOFFSET to offset the ARROWS left or right of that data position.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if you need more explanation.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 14:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598294#M18998</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2019-10-22T14:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598393#M18999</link>
      <description>&lt;P&gt;How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="x.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33346iDB8BAAD9912475F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="x.png" alt="x.png" /&gt;&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 have;
infile cards truncover;
input id sex $ per p l h v : $10. w pp;
format w percent7.0;
cards;
1 F 0.3 .  . . . . .
1 M 0.7 0.7 0.3 0.7 —————— 0.4 0.72
2 F 0.4  . . . . . .
2 M 0.6 0.6 0.4 0.6 —————— 0.2 0.62
;

proc sgplot data=have;
vbarparm category=id response=per /group=sex  groupdisplay=cluster;
scatter x=id y=p/ markerchar=v discreteoffset=-0.09 ;
scatter x=id y=pp/ markerchar=w discreteoffset=-0.2 markercharattrs=(size=10) ;
scatter x=id y=p/ markerattrs=(symbol=trianglerightfilled color=black size=10) 
discreteoffset=-0.02 ;
highlow x=id low=l high=h/discreteoffset=-0.2 lineattrs=(color=black) lowcap=filledarrow;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Oct 2019 13:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598393#M18999</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-10-22T13:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598407#M19000</link>
      <description>&lt;P&gt;Which is more important: keeping the order of the Vbars or having the range indicator on a specific side?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The example you show has ALL of the larger values in one of the subgroups for the X-axis variable. What do you want to have for appearance if the larger value changes for some groups?&lt;/P&gt;
&lt;P&gt;Do want the range indicator to always be on the left (as shown) or keep the bars in the same order and have the range indicator move to the right side of the pair as needed?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 14:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598407#M19000</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-22T14:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598413#M19001</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards truncover;
input id time $ per p l h v : $10. w pp;
format per p l h w pp PERCENTN8.1;
cards;
1 Before .473 . . . . . .
1 After .379 .473 .379 .473 ——— -.2 .493
2 Before .778 . . . . . .
2 After .619 .778 .619 .778 ——— -.204 .798 
;

proc sgplot data=test;
vbarparm category=id response=per /group=time  groupdisplay=cluster;
scatter x=id y=p/ markerchar=v discreteoffset=0.09 ;  ** top line **;
scatter x=id y=p/ markerattrs=(symbol=triangleleftfilled color=black size=10) discreteoffset=0.02 ;  ** arrow to the right **;
scatter x=id y=pp/ markerchar=w discreteoffset=0.2 markercharattrs=(size=10) ;  ** percent label **;
highlow x=id low=l high=h/discreteoffset=0.2 lineattrs=(color=black) lowcap=filledarrow;	** arrow pointing down **;
yaxis offsetmin=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotated Cluster Bar Plot using SGPLOT-results.JPG" style="width: 529px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33347iC565A223633D9AD5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotated Cluster Bar Plot using SGPLOT-results.JPG" alt="Annotated Cluster Bar Plot using SGPLOT-results.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made some minor modifications to fit my data but this was great!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Ksharp!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 15:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598413#M19001</guid>
      <dc:creator>Awesome1</dc:creator>
      <dc:date>2019-10-22T15:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598416#M19002</link>
      <description>&lt;P&gt;Thanks for the response! Much appreciated. I'll use this during formatting.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 14:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598416#M19002</guid>
      <dc:creator>Awesome1</dc:creator>
      <dc:date>2019-10-22T14:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598417#M19003</link>
      <description>&lt;P&gt;I see where Ksharp used these in their code.&amp;nbsp;Thanks for the response and offer of additional assistance! Greatly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 14:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598417#M19003</guid>
      <dc:creator>Awesome1</dc:creator>
      <dc:date>2019-10-22T14:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create an Annotated Cluster Bar Plot Using SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598431#M19004</link>
      <description>&lt;P&gt;Thanks for responding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think keeping the order of the vbars will make it easier to take in with multiple before/after tests so I'd say it is more important. I definitely want to&lt;SPAN&gt;&amp;nbsp;keep the bars in the same order and have the range indicator move to the right side of the pair as needed!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The image provided just happened to have increases after the intervention but my data has reductions in proportions. I was able to modify the code Ksharp provided to capture this. I'm working on making it more automated but it is a great start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have any ideas on how to best do so, I'd love to hear them!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your response!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 15:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Create-an-Annotated-Cluster-Bar-Plot-Using-SGPLOT/m-p/598431#M19004</guid>
      <dc:creator>Awesome1</dc:creator>
      <dc:date>2019-10-22T15:30:32Z</dc:date>
    </item>
  </channel>
</rss>

