<?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 Proc Sgrender and Annotate in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231254#M8380</link>
    <description>&lt;P&gt;Using SAS 9.4 I am trying to create a bar chart (with various other points on it) with a table on the bottom. Currently my bar chart contains the observed and I am using a marker to show the expected. I would like to include a table at the bottom that has the delta between the observed and the expected. From what I read I need to use proc sgrender because my bar chat contains bars and a scatterplot, however that is not causing me a problem when writing annotate ( I will admit this is my first time using annotate). Without the annotate, my bar chart works percectly and I have my desired chart, without the table. Unfortunately, when I add the annotate code, nothing happens to my chart. I'm looking for some help as to whether I am missing something with my code or whether there is an easier way to achieve my desired graph.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics/ width=8in;&lt;BR /&gt;proc template;&lt;BR /&gt;define statgraph percent_target;&lt;BR /&gt;begingraph;&lt;BR /&gt;layout overlay / xaxisopts=(label='Grade')&lt;BR /&gt;yaxisopts=(label='Percent' display=none)&lt;BR /&gt;borderattrs=(color=white)&lt;BR /&gt;walldisplay=none;&lt;BR /&gt;barchart x=grade_level y=percent_Target /orient=vertical barlabel=True barlabelattrs=(size=12pt) fillattrs=(color=CX4F81BD)barwidth=.5 outlineattrs=(color=CX4F81BD)&lt;BR /&gt;name='percent' legendlabel='Observed YTD Growth, % of Target';&lt;BR /&gt;annotate;&lt;BR /&gt;scatterplot x=grade_level y=MOY_Expected_PTarget / markerattrs=(color=CXED7D31 symbol=squarefilled)&lt;BR /&gt;name='expected' legendlabel='Expected YTD Growth, % of Target';&lt;BR /&gt;referenceline y=1 /curvelabel='Annual Target 100%' lineattrs=(color=CX00B050)curvelabelattrs=(size=12pt);&lt;BR /&gt;/*seriesplot x=grade_level y=annual_target / lineattrs=(color=CX00B050) */&lt;BR /&gt;/* name='annual' legendlabel='Annual Growth Target';*/&lt;BR /&gt;discretelegend 'percent' 'expected'/ border=false;&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Insert the Annotate code*/&lt;/P&gt;&lt;P&gt;data delta; set delta;&lt;BR /&gt;if grade_level='K' then grade=00;&lt;BR /&gt;else grade=grade_level;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data delta; set delta;&lt;BR /&gt;drop grade_level;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data matha readinga; set delta;&lt;BR /&gt;if subject='Mathematics' then output matha;&lt;BR /&gt;if subject='Reading' then output readinga;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data matha; set matha;&lt;BR /&gt;drop subject;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=matha;&lt;BR /&gt;by grade;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data annotate1; set matha; by grade;&lt;BR /&gt;x=grade; y=0.3; format text $50. function ;&lt;BR /&gt;function='label';&lt;BR /&gt;text=(round((delta*100),1));&lt;BR /&gt;position='8';&lt;BR /&gt;size=1;&lt;BR /&gt;xysy='2'; ysys='2';&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title1 j=left height=15 bold "Growth";&lt;BR /&gt;title2 j=left height=8 bold "Percentage of target achieved, compared to percent of target expectations.";&lt;BR /&gt;footnote1 j=left height=3.5 "This is the percent of target achieved at this point of time.";&lt;BR /&gt;proc sgrender data=g_p_target template=percent_target sganno=annotate1;&lt;BR /&gt;where subject='Mathematics';&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Oct 2015 19:44:52 GMT</pubDate>
    <dc:creator>Amber1331</dc:creator>
    <dc:date>2015-10-22T19:44:52Z</dc:date>
    <item>
      <title>Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231254#M8380</link>
      <description>&lt;P&gt;Using SAS 9.4 I am trying to create a bar chart (with various other points on it) with a table on the bottom. Currently my bar chart contains the observed and I am using a marker to show the expected. I would like to include a table at the bottom that has the delta between the observed and the expected. From what I read I need to use proc sgrender because my bar chat contains bars and a scatterplot, however that is not causing me a problem when writing annotate ( I will admit this is my first time using annotate). Without the annotate, my bar chart works percectly and I have my desired chart, without the table. Unfortunately, when I add the annotate code, nothing happens to my chart. I'm looking for some help as to whether I am missing something with my code or whether there is an easier way to achieve my desired graph.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics/ width=8in;&lt;BR /&gt;proc template;&lt;BR /&gt;define statgraph percent_target;&lt;BR /&gt;begingraph;&lt;BR /&gt;layout overlay / xaxisopts=(label='Grade')&lt;BR /&gt;yaxisopts=(label='Percent' display=none)&lt;BR /&gt;borderattrs=(color=white)&lt;BR /&gt;walldisplay=none;&lt;BR /&gt;barchart x=grade_level y=percent_Target /orient=vertical barlabel=True barlabelattrs=(size=12pt) fillattrs=(color=CX4F81BD)barwidth=.5 outlineattrs=(color=CX4F81BD)&lt;BR /&gt;name='percent' legendlabel='Observed YTD Growth, % of Target';&lt;BR /&gt;annotate;&lt;BR /&gt;scatterplot x=grade_level y=MOY_Expected_PTarget / markerattrs=(color=CXED7D31 symbol=squarefilled)&lt;BR /&gt;name='expected' legendlabel='Expected YTD Growth, % of Target';&lt;BR /&gt;referenceline y=1 /curvelabel='Annual Target 100%' lineattrs=(color=CX00B050)curvelabelattrs=(size=12pt);&lt;BR /&gt;/*seriesplot x=grade_level y=annual_target / lineattrs=(color=CX00B050) */&lt;BR /&gt;/* name='annual' legendlabel='Annual Growth Target';*/&lt;BR /&gt;discretelegend 'percent' 'expected'/ border=false;&lt;BR /&gt;endlayout;&lt;BR /&gt;endgraph;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/*Insert the Annotate code*/&lt;/P&gt;&lt;P&gt;data delta; set delta;&lt;BR /&gt;if grade_level='K' then grade=00;&lt;BR /&gt;else grade=grade_level;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data delta; set delta;&lt;BR /&gt;drop grade_level;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data matha readinga; set delta;&lt;BR /&gt;if subject='Mathematics' then output matha;&lt;BR /&gt;if subject='Reading' then output readinga;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data matha; set matha;&lt;BR /&gt;drop subject;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=matha;&lt;BR /&gt;by grade;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data annotate1; set matha; by grade;&lt;BR /&gt;x=grade; y=0.3; format text $50. function ;&lt;BR /&gt;function='label';&lt;BR /&gt;text=(round((delta*100),1));&lt;BR /&gt;position='8';&lt;BR /&gt;size=1;&lt;BR /&gt;xysy='2'; ysys='2';&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title1 j=left height=15 bold "Growth";&lt;BR /&gt;title2 j=left height=8 bold "Percentage of target achieved, compared to percent of target expectations.";&lt;BR /&gt;footnote1 j=left height=3.5 "This is the percent of target achieved at this point of time.";&lt;BR /&gt;proc sgrender data=g_p_target template=percent_target sganno=annotate1;&lt;BR /&gt;where subject='Mathematics';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 19:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231254#M8380</guid>
      <dc:creator>Amber1331</dc:creator>
      <dc:date>2015-10-22T19:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231256#M8381</link>
      <description>&lt;P&gt;You may be making this more complex than necessary. &amp;nbsp;You can likely use SGPLOT for this. &amp;nbsp;If data is summarized by category (or you can summarize it using Proc Means), you can use a VBARPARM to draw the bar, and overlay a SCATTER or HIGHLOW (with same high and low values). &amp;nbsp;Compute the differences in another column and use a XAXISTABLE to draw the difference values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 19:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231256#M8381</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-10-22T19:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231258#M8382</link>
      <description>&lt;P&gt;Here is sample code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data bar;&lt;BR /&gt;&amp;nbsp; input Product $ Actual Expected;&lt;BR /&gt;&amp;nbsp; Diff=Expected-Actual;&lt;BR /&gt;&amp;nbsp; datalines;&lt;BR /&gt;Chairs 300 200&lt;BR /&gt;Tables 250 300&lt;BR /&gt;Lamps 200 150&lt;BR /&gt;Sofas 100 120&lt;BR /&gt;;&lt;BR /&gt;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods html close;&lt;BR /&gt;ods listing gpath='C:\Work\SASUser';&lt;BR /&gt;ods graphics / reset width=5in height=3in imagename='BarDiff';&lt;BR /&gt;proc sgplot data=bar;&lt;BR /&gt;&amp;nbsp; vbarparm category=product response=actual;&lt;BR /&gt;&amp;nbsp; scatter x=product y=expected / markerattrs=(symbol=circlefilled size=10);&lt;BR /&gt;&amp;nbsp; xaxistable diff / location=inside position=top valueattrs=(size=10) separator;&lt;BR /&gt;&amp;nbsp; yaxis offsetmin=0;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12029i0927B3D70C4361C2/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="BarDiff.png" title="BarDiff.png" /&gt;</description>
      <pubDate>Thu, 22 Oct 2015 20:18:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231258#M8382</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-10-22T20:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231261#M8383</link>
      <description>&lt;P&gt;Here's an example of putting the expected value on a bar chart: (scroll about halfway down the article):&lt;BR /&gt;&lt;A href="http://blogs.sas.com/content/iml/2012/04/04/fitting-a-poisson-distribution-to-data-in-sas.html" target="_self"&gt;"Fitting a Poisson distribution to data in SAS"&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It uses the VBARPARM and SCATTER statements.&amp;nbsp; If you have SAS 9.4, you can use the XAXISTABLE statement to draw the text. Otherwise, use another SCATTER statement with the MARKERCHAR= option to get the text onthe graph.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 20:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231261#M8383</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-10-22T20:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231263#M8384</link>
      <description>&lt;P&gt;Thank you for all your help. This created the exact graph and table combination that I needed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 20:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231263#M8384</guid>
      <dc:creator>Amber1331</dc:creator>
      <dc:date>2015-10-22T20:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231264#M8385</link>
      <description>&lt;P&gt;Thank you for the article. This will be helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 20:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231264#M8385</guid>
      <dc:creator>Amber1331</dc:creator>
      <dc:date>2015-10-22T20:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgrender and Annotate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231269#M8387</link>
      <description>&lt;P&gt;Alternate appearance. &amp;nbsp;Except including the "Expected" in the legend. &amp;nbsp;Could be done with a few more gyrations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=bar;&lt;BR /&gt;&amp;nbsp; vbarparm category=product response=actual / name='a';&lt;BR /&gt;&amp;nbsp; highlow x=product high=expected low=expected / type=bar barwidth=0.4&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;discreteoffset=-0.1 legendlabel='Expected';&lt;BR /&gt;&amp;nbsp; xaxistable diff / location=inside position=top valueattrs=(size=10) separator;&lt;BR /&gt;&amp;nbsp; yaxis offsetmin=0 offsetmax=0.1 display=(nolabel);&lt;BR /&gt;&amp;nbsp; xaxis display=(nolabel);&lt;BR /&gt;&amp;nbsp; keylegend 'a';&lt;BR /&gt;run;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12030iB9AD2FE6FA59A3AF/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="BarDiff2.png" title="BarDiff2.png" /&gt;</description>
      <pubDate>Thu, 22 Oct 2015 21:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Proc-Sgrender-and-Annotate/m-p/231269#M8387</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-10-22T21:31:37Z</dc:date>
    </item>
  </channel>
</rss>

