<?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 do I use the axis table statement to add n's to bar chart? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272181#M9704</link>
    <description>&lt;P&gt;I think using "Label="string" doesn't work because I need to have a class statement. When I tried it just now, I lost the "# with X-Ray" altogether. Thanks for the idea though!&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2016 21:21:11 GMT</pubDate>
    <dc:creator>Lefty</dc:creator>
    <dc:date>2016-05-20T21:21:11Z</dc:date>
    <item>
      <title>How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272177#M9702</link>
      <description>&lt;P&gt;Hi, I am using proc template in SAS 9.4 to create a bar chart with a line overlaid. The graph has percentages on the left y-axis and I would like to write the n’s (the variable COUNT, from which the percentages are derived) near the bars of the graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data look like this:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;Better_or_Not&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;COUNT&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;Percent_Xray&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;Month&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;RDQ&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;17&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;166&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;28&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;18&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;28&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;5&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;18&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;9&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;45&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;8&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;18&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;15&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;18&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;21&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;84&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;14&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;24&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;17&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;15&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;85&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;42&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;9&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;6&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;12&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;15&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;18&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;21&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="106"&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;14&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;7&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;24&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106"&gt;
&lt;P&gt;4&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And here is the code I used:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
define statgraph dashboard.trend;

begingraph/attrpriority=none datacolors=(bib bioy) datacontrastcolors=(bib bioy) datalinepatterns=(1 9);

 entrytitle 'Figure 2A. Percent with X-Ray Stratified by Improvement Status'; 
 
 layout overlay /cycleattrs=true 

yaxisopts=(griddisplay=on label='Percent With X-Ray' linearopts=(viewmin=0))

y2axisopts=(label='Average RDQ'  labelfitpolicy=split linearopts=(viewmin=0 viewmax=24))
					
xaxisopts =(label='Interview' labelposition=right display=(ticks tickvalues line)discreteopts=(TICKTYPE=INBETWEEN))

x2axisopts=(display=none);

barchart x=Month y=percent_Xray/group=BETTER_OR_NOT groupdisplay=cluster name='bar1' xaxis=x PRIMARY=TRUE yaxis=y;

seriesplot x=Month y=RDQ/ group=BETTER_OR_NOT display=(markers) MARKERATTRS=(symbol=circlefilled) yaxis=y2 name='line'  ;

innermargin/align=bottom ;

axistable x=Month value=Count/classdisplay=cluster
class=BETTER_OR_NOT Title='# with X-Ray:' titleATTRS=(size=12)
titlehalign=auto display=(values) colorgroup=BETTER_OR_NOT
valueattrs=(size=12) showmissing=false ;
 endinnermargin;

discretelegend 'bar1'   /title='% With X-Ray' location=outside valign=bottom halign=center;
discretelegend  'line'  /title=’Trajectory' location=outside valign=top halign=center;

    endlayout;
	 entrytitle "With RDQ Over Time" ;
  endgraph;
  end;
run;


 proc sgrender data=xrayfreqsandmeans template=dashboard.trend ;
 format Month Monthf.;
 format BETTER_OR_NOT BETTER_OR_NOTf.;
 run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And here is the graph that results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3277iB184D8485F53CF22/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Example graph for SAS forum.docx.png" title="Example graph for SAS forum.docx.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It’s very close to what I want, but does anyone know if there’s a way to move the numbers below the bars (166, 85, 28, 7, etc) up so they are directly under the bars? Or at least move the axis table title (“# with X-Ray) down so it lines up with those numbers? Thanks so much in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 21:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272177#M9702</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2016-05-20T21:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272178#M9703</link>
      <description>&lt;P&gt;Use LABEL instead of TITLE on the AXISTABLE, and the label should line up with your values.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 21:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272178#M9703</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-05-20T21:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272181#M9704</link>
      <description>&lt;P&gt;I think using "Label="string" doesn't work because I need to have a class statement. When I tried it just now, I lost the "# with X-Ray" altogether. Thanks for the idea though!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 21:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272181#M9704</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2016-05-20T21:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272184#M9705</link>
      <description>&lt;P&gt;Ah, that's right. Well, another alternative would be to turn off the AXISTABLE title and use an ENTRY statement to position the title at the bottom-left of the LAYOUT OVERLAY (halign=left valign=bottom), Give that a try, and see if that works for you.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 21:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272184#M9705</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-05-20T21:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272191#M9706</link>
      <description>&lt;P&gt;Thanks Dan! It's so close but still not quite. I tried using Entryfootnote too but that just put the text all the way on the bottom left even below the legend. I used this code, right after my barchart statement but before my innermargin code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;entry halign=left &amp;nbsp;"# with X-Ray"/valign=bottom ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;!&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3278i2C659E62B8889639/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Example graph for SAS forum entry.png" title="Example graph for SAS forum entry.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 21:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272191#M9706</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2016-05-20T21:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272193#M9707</link>
      <description>&lt;P&gt;I see. YOu got that behavior because the axis table is in the inner margin. But, there is still a way &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the DRAWTEXT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;drawtext "# with X-RAY" / drawspace=wallpercent anchor=bottomleft x=0 y=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can tweak the X and Y values slightly to get it just where you want it. Give that a try and see if it works for you.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 21:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272193#M9707</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-05-20T21:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the axis table statement to add n's to bar chart?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272196#M9708</link>
      <description>&lt;P&gt;Success!! I so appreciate it, thank you! I wound up with x=8 and y=-1 to get the text where it is in this graph. Thank you again!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3279iF61086834714A810/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="graph success!.png" title="graph success!.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 22:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-use-the-axis-table-statement-to-add-n-s-to-bar-chart/m-p/272196#M9708</guid>
      <dc:creator>Lefty</dc:creator>
      <dc:date>2016-05-20T22:02:27Z</dc:date>
    </item>
  </channel>
</rss>

