<?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 help in graphs - another question in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822473#M22953</link>
    <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;this is my code:&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;infile cards expandtabs;&lt;BR /&gt;input year customer $ amount div;&lt;BR /&gt;cards;&lt;BR /&gt;1994 AAA 1000 500&lt;BR /&gt;1994 A 800 .&lt;BR /&gt;1994 BBB 500 .&lt;BR /&gt;1994 c 10 .&lt;BR /&gt;1995 AAA 2000 1500&lt;BR /&gt;1995 A 1500 .&lt;BR /&gt;1995 BBB 500 .&lt;BR /&gt;1995 c 100 .&lt;BR /&gt;1996 AAA 800 600&lt;BR /&gt;1996 A 1200 .&lt;BR /&gt;1996 BBB 200 .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc sgplot data=a;&lt;BR /&gt;vbar year / response=amount group=customer groupdisplay=cluster&lt;BR /&gt;grouporder=data nostatlabel datalabel ;&lt;BR /&gt;yaxis grid display=(nolabel);&lt;BR /&gt;xaxis display=(nolabel);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;this is the output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IditMaor_0-1657460360284.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73112iC40418C90BB47305/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IditMaor_0-1657460360284.png" alt="IditMaor_0-1657460360284.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. I need the numbers to be on the bars and not on top of the bars.&lt;/P&gt;&lt;P&gt;2. I need to add the variable "div" on the bars, how to do this?&lt;/P&gt;&lt;P&gt;then graphs needs to look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IditMaor_1-1657460510824.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73113i590AB13DBBF93AFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IditMaor_1-1657460510824.png" alt="IditMaor_1-1657460510824.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Jul 2022 13:42:01 GMT</pubDate>
    <dc:creator>IditMaor</dc:creator>
    <dc:date>2022-07-10T13:42:01Z</dc:date>
    <item>
      <title>help in graphs - another question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822473#M22953</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;this is my code:&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;infile cards expandtabs;&lt;BR /&gt;input year customer $ amount div;&lt;BR /&gt;cards;&lt;BR /&gt;1994 AAA 1000 500&lt;BR /&gt;1994 A 800 .&lt;BR /&gt;1994 BBB 500 .&lt;BR /&gt;1994 c 10 .&lt;BR /&gt;1995 AAA 2000 1500&lt;BR /&gt;1995 A 1500 .&lt;BR /&gt;1995 BBB 500 .&lt;BR /&gt;1995 c 100 .&lt;BR /&gt;1996 AAA 800 600&lt;BR /&gt;1996 A 1200 .&lt;BR /&gt;1996 BBB 200 .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc sgplot data=a;&lt;BR /&gt;vbar year / response=amount group=customer groupdisplay=cluster&lt;BR /&gt;grouporder=data nostatlabel datalabel ;&lt;BR /&gt;yaxis grid display=(nolabel);&lt;BR /&gt;xaxis display=(nolabel);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;this is the output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IditMaor_0-1657460360284.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73112iC40418C90BB47305/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IditMaor_0-1657460360284.png" alt="IditMaor_0-1657460360284.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1. I need the numbers to be on the bars and not on top of the bars.&lt;/P&gt;&lt;P&gt;2. I need to add the variable "div" on the bars, how to do this?&lt;/P&gt;&lt;P&gt;then graphs needs to look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IditMaor_1-1657460510824.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73113i590AB13DBBF93AFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IditMaor_1-1657460510824.png" alt="IditMaor_1-1657460510824.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2022 13:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822473#M22953</guid>
      <dc:creator>IditMaor</dc:creator>
      <dc:date>2022-07-10T13:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: help in graphs - another question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822681#M22957</link>
      <description>&lt;P&gt;Will the SEGLABEL do what you want instead of DATALABEL?&lt;/P&gt;
&lt;PRE&gt;data a;
infile cards expandtabs;
input year customer $ amount div;
cards;
1994 AAA 1000 500
1994 A 800 .
1994 BBB 500 .
1994 c 10 .
1995 AAA 2000 1500
1995 A 1500 .
1995 BBB 500 .
1995 c 100 .
1996 AAA 800 600
1996 A 1200 .
1996 BBB 200 .

;

proc sgplot data=a;
   vbar year / response=amount group=customer groupdisplay=cluster
               grouporder=data nostatlabel 
               seglabel 
   ;
   yaxis grid display=(nolabel);
   xaxis display=(nolabel);
run;&lt;/PRE&gt;
&lt;P&gt;DATALABEL is for the entire bar. SEGLABEL is for the segments created by the Group variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What/where is the DIV value supposed to appear? If you want much control you may have to move to combining a VBARBASIC and maybe a Text plot. VBAR graphs are restricted as to which other plots they combine with.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 21:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822681#M22957</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-11T21:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: help in graphs - another question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822728#M22958</link>
      <description>&lt;P&gt;Here is one possibility:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-07-11 at 9.17.52 PM.png" style="width: 723px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73183i37044A316921F3C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-07-11 at 9.17.52 PM.png" alt="Screen Shot 2022-07-11 at 9.17.52 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The key changes in the program below are the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;RETAIN a column in the data step to position the DIV labels against the Y axis&lt;/LI&gt;
&lt;LI&gt;Replace all of the missing values in the DIV column with the correct DIV value for that observation&lt;/LI&gt;
&lt;LI&gt;Use a VBARPARM instead of a VBAR so that you can overlay the TEXT plot&lt;/LI&gt;
&lt;LI&gt;Use a SEGLABEL instead of a DATALABEL to move the bar values inside of the bars&lt;/LI&gt;
&lt;LI&gt;Use a TEXT plot to render the DIV labels on top of the bar chart&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Let me know if you have any questions about this approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards expandtabs;
retain ydiv 100;
input year customer $ amount div;
cards;
1994 AAA 1000 500
1994 A 800 500
1994 BBB 500 500
1994 c 10 500
1995 AAA 2000 1500
1995 A 1500 1500
1995 BBB 500 1500
1995 c 100 1500
1996 AAA 800 600
1996 A 1200 600
1996 BBB 200 600
;

proc sgplot data=a;
vbarparm category=year response=amount / group=customer groupdisplay=cluster
         grouporder=data seglabel seglabelattrs=(color=white);
text x=year y=ydiv text=div / textattrs=(size=12pt)
     backfill fillattrs=(color=tan) strip;
yaxis grid display=(nolabel);
xaxis display=(nolabel);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 01:28:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822728#M22958</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-07-12T01:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: help in graphs - another question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822808#M22959</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards expandtabs;
input year customer $ amount div;
x1=10;
x2=400;
format div percent10.0;
cards;
1994 AAA 1000 .5
1994 A 800 .5
1994 BBB 500 .5
1994 c 10 .5
1995 AAA 2000 .15
1995 A 1500 .15
1995 BBB 500 .15
1995 c 100 .15
1996 AAA 800 .6
1996 A 1200 .6
1996 BBB 200 .6

;

proc sgplot data=a noborder  noautolegend ;
styleattrs datacolors=(CX238B45 CX74C476 CXBAE4B3 CXEDF8E9);

vbarparm category=year  response=amount /group=customer  groupdisplay=cluster grouporder=data 
nooutline barwidth=0.9 ;


text x=year y=x1 text=amount/position=right group=customer groupdisplay=cluster  
rotate=90 strip contributeoffsets=none textattrs=(size=10 weight=bold color=black);

text x=year y=x2 text=div/backfill fillattrs=(color=orange) 
textattrs=(size=10  weight=bold color=black)  strip contributeoffsets=none;

yaxis grid display=(nolabel noline noticks);
xaxis 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="Ksharp_0-1657627172143.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73207iFF5112E01D07074F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1657627172143.png" alt="Ksharp_0-1657627172143.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 11:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822808#M22959</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-12T11:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: help in graphs - another question</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822823#M22960</link>
      <description>&lt;P&gt;thank you very match&lt;/P&gt;&lt;P&gt;Idit Maor&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 12:57:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/help-in-graphs-another-question/m-p/822823#M22960</guid>
      <dc:creator>IditMaor</dc:creator>
      <dc:date>2022-07-12T12:57:52Z</dc:date>
    </item>
  </channel>
</rss>

