<?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: Can't get butterfly chart to display values in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858378#M23486</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
As Ballardw said,
post some data,so we can test your code.
*/


proc format;
	picture posval low-&amp;lt;0='00000%'
	(prefix='-')
	 0='9%'
	 0&amp;lt;-high='00000%';
run;

data have;
call streaminit(123);
do date='01jan2022'd  to '20jan2022'd;
 value=rand('integer',-100,100);
 group=ifc(value&amp;gt;0,'pos_diff','neg_diff');
 output;
end;
format date date9.  value posval.;
run;



proc sgplot data=have;
hbarparm category=date response=value/group=group datalabel=value
 GROUPDISPLAY=CLUSTER  DATALABELFITPOLICY=INSIDEPREFERRED
;
keylegend /title='';
yaxis label='';
xaxis label='';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1676107637284.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80326i3C8E55661F797AFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1676107637284.png" alt="Ksharp_0-1676107637284.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Feb 2023 09:27:30 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2023-02-11T09:27:30Z</dc:date>
    <item>
      <title>Can't get butterfly chart to display values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858355#M23484</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am trying to create a butterfly graph and it's almost there but not yet. I need to add the values of the bars and convert everything to percentages. I would also like to add 2 vertical dashed lines at -20% and + 20%.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done what I can so can someone get me a bit further?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paula&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc format;
	picture posval low-&amp;lt;0='00000%'
	(prefix='-')
	 0='9%'
	 0&amp;lt;-high='00000%';
run;


data sales;
	set sales;
	if pct_diff &amp;lt; 0 then neg_diff = pct_diff; 
	if pct_diff &amp;gt;= 0 then pos_diff = pct_diff;
	zero = 0;
run;

title1 '% Change of Sales between Dates'; 
proc sgplot data=sales;
  format pct_diff posval.;
  hbarparm category=rundt response=neg_diff /  
    datalabel=pct_diff datalabelattrs=(size=10);
  hbarparm category=rundt response=pos_diff /  
    datalabel=pct_diff datalabelattrs=(size=10);
  xaxis values=(-10 to 10 by .25) display=(nolabel) grid;
  yaxis display=(nolabel);
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Butterfly.jpg" style="width: 695px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80320i2F3C9254F11BCA97/image-size/large?v=v2&amp;amp;px=999" role="button" title="Butterfly.jpg" alt="Butterfly.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2023 22:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858355#M23484</guid>
      <dc:creator>SASGeek</dc:creator>
      <dc:date>2023-02-10T22:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get butterfly chart to display values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858374#M23485</link>
      <description>&lt;P&gt;You included a format in your code but do not show where you might be using it.&lt;/P&gt;
&lt;P&gt;This is interesting because you are using variable names like Pct_dif which leads one to expect percentages of some type are involved. The interesting thing about that shown format is that most values between -1 and 1 do not display (i.e. decimal values such as 0.99 that one might in some circumstances expect to see displayed as 99%. So if you have the format attached to your datalabel variable that might be surpressing the results&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may be that a TEXT plot superimposed on your hbarparm could be the best way to display the text other than where default datalabels might go.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data.&lt;/P&gt;
&lt;P&gt;Can't plot without actual data.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2023 05:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858374#M23485</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-11T05:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get butterfly chart to display values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858378#M23486</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
As Ballardw said,
post some data,so we can test your code.
*/


proc format;
	picture posval low-&amp;lt;0='00000%'
	(prefix='-')
	 0='9%'
	 0&amp;lt;-high='00000%';
run;

data have;
call streaminit(123);
do date='01jan2022'd  to '20jan2022'd;
 value=rand('integer',-100,100);
 group=ifc(value&amp;gt;0,'pos_diff','neg_diff');
 output;
end;
format date date9.  value posval.;
run;



proc sgplot data=have;
hbarparm category=date response=value/group=group datalabel=value
 GROUPDISPLAY=CLUSTER  DATALABELFITPOLICY=INSIDEPREFERRED
;
keylegend /title='';
yaxis label='';
xaxis label='';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1676107637284.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80326i3C8E55661F797AFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1676107637284.png" alt="Ksharp_0-1676107637284.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2023 09:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858378#M23486</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-02-11T09:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get butterfly chart to display values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858434#M23487</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

proc sgplot data=have;
hbarparm category=date response=value/group=group datalabel=value
 GROUPDISPLAY=CLUSTER  DATALABELFITPOLICY=INSIDEPREFERRED
;
keylegend /title='';
refline -20 20/axis=x lineattrs=(pattern=shortdash) ;
yaxis label=' ';
xaxis label=' ' values=(-100 to 100 by 20);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1676190585529.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80341i6D8BF309F34676A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1676190585529.png" alt="Ksharp_0-1676190585529.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Feb 2023 08:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858434#M23487</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-02-12T08:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can't get butterfly chart to display values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858555#M23491</link>
      <description>Thanks so much! This is perfect!</description>
      <pubDate>Mon, 13 Feb 2023 18:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Can-t-get-butterfly-chart-to-display-values/m-p/858555#M23491</guid>
      <dc:creator>SASGeek</dc:creator>
      <dc:date>2023-02-13T18:28:34Z</dc:date>
    </item>
  </channel>
</rss>

