<?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: Vertical reference lines on proc gchart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103599#M3850</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On a second thought, if you have access to SAS 9.2. +&amp;nbsp; then you could use the SGPLOT&lt;/P&gt;&lt;P&gt;proc sgplot data=a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar year /freq = y ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;refline 91 93&lt;/STRONG&gt; / axis = x &lt;STRONG&gt;discreteoffset = 0.5&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*axis = x tells SAS this is a vertical line */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*the discreteoffset tells SAS to move to line 0.5 units (to the right) from the 91 and 93 - thus giving you 91.5, and 93.5)*/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fairly new to SGPLOT, but it turns out it has lots of features ready to be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck, again!&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11798i2497C0803E42D8D3/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="SGPlot8.png" title="SGPlot8.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Oct 2012 12:22:30 GMT</pubDate>
    <dc:creator>AncaTilea</dc:creator>
    <dc:date>2012-10-23T12:22:30Z</dc:date>
    <item>
      <title>Vertical reference lines on proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103597#M3848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I would like to include some vertical reference lines inside a proc gchart graph.&lt;/P&gt;&lt;P&gt;Is there anyway to use the tags vref instead of using a annotate dataset?&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;&lt;P&gt;/paolo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;goptions reset=all border cback=white htitle=12pt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; /* Create input data set, A */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data a;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; input Year Y;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; datalines;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;90 40&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;91 85&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;92 80&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;93 50&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;94 90&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;95 80&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; /* Create the Annotate data set */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data anno_ds;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; length color function $8 text $14;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; retain xsys '1' ysys '2' when 'a';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; function='move'; x=33.5; y=0; output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; function='draw'; x=33.5; y=100; color='black'; size=2; output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; function='move'; x=67; y=0; output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; function='draw'; x=67; y=100; color='black'; size=2; output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; /* Add a title to the graph */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;title1 'Sales Report';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; /* Define axis characteristics */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;axis1 order=(0 to 100 by 25);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; /* Produce the bar chart using the ANNO= */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; /* option on the VBAR statement */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;proc gchart data=a;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; vbar year / sumvar=y raxis=axis1 discrete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width=8 anno=anno_ds;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11116i8219C9D7688DC308/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="gchart_reflines.png" title="gchart_reflines.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 09:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103597#M3848</guid>
      <dc:creator>paolo_santin</dc:creator>
      <dc:date>2012-10-23T09:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Vertical reference lines on proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103598#M3849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, PROC GCHART of SAS does not allow for a "vref = " option. (It allows it, but it doesn't produce anything).&lt;/P&gt;&lt;P&gt;The best way to go about drawing vertical lines on a bar-plot is to use the annotate capability.&lt;/P&gt;&lt;P&gt;(Of course, you could also tinker around with footnotes and move/draw combination but it's not worth it if you have the annotate in place).&lt;/P&gt;&lt;P&gt;Best of luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 12:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103598#M3849</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2012-10-23T12:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Vertical reference lines on proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103599#M3850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On a second thought, if you have access to SAS 9.2. +&amp;nbsp; then you could use the SGPLOT&lt;/P&gt;&lt;P&gt;proc sgplot data=a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vbar year /freq = y ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;refline 91 93&lt;/STRONG&gt; / axis = x &lt;STRONG&gt;discreteoffset = 0.5&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*axis = x tells SAS this is a vertical line */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*the discreteoffset tells SAS to move to line 0.5 units (to the right) from the 91 and 93 - thus giving you 91.5, and 93.5)*/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am fairly new to SGPLOT, but it turns out it has lots of features ready to be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck, again!&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11798i2497C0803E42D8D3/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="SGPlot8.png" title="SGPlot8.png" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 12:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103599#M3850</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2012-10-23T12:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Vertical reference lines on proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103600#M3851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct - the only way (I know of) to draw reference lines between the bars in Gchart is to annotate them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One work-around is to use Gplot, with the 'needle' interpolation, and make the needles very wide so they look like bars.&amp;nbsp; One advantage here is that you will be able to use x-values directly to position the reference lines (such as 91.5, rather than having to calculate that it's at position x=33.5%).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A Gplot line chart is not really a bar chart, so you have a few trade-offs ... for example, the bars will be spaced out proportionally rather than evenly-spaced (so hopefully your x-values are always evenly-spaced increments), and since these are 'lines' and not bars you will hot be able to associate html hover-text or drilldowns with them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That being said, here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title1 'Sales Report';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;axis1 order=(0 to 100 by 25) minor=none offset=(0,0);&lt;/P&gt;&lt;P&gt;axis2 minor=none offset=(10,10);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;symbol1 value=none interpol=needle width=40;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc gplot data=a;&lt;/P&gt;&lt;P&gt; plot y*year=1 / vaxis=axis1 haxis=axis2&lt;/P&gt;&lt;P&gt;&amp;nbsp; href=91.5 93.5;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 12:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103600#M3851</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2012-10-23T12:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Vertical reference lines on proc gchart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103601#M3852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 12:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Vertical-reference-lines-on-proc-gchart/m-p/103601#M3852</guid>
      <dc:creator>paolo_santin</dc:creator>
      <dc:date>2012-10-23T12:45:31Z</dc:date>
    </item>
  </channel>
</rss>

