<?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: adding an equation to draw to a plot statement in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22611#M601</link>
    <description>Thank you for yours answers</description>
    <pubDate>Fri, 04 Dec 2009 14:24:24 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-12-04T14:24:24Z</dc:date>
    <item>
      <title>adding an equation to draw to a plot statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22608#M598</link>
      <description>Hello dears sas users&lt;BR /&gt;
My problem is the following:&lt;BR /&gt;
imagine that i have a plot to draw and i want also to add in the graphic an equation&lt;BR /&gt;
like Y=X&lt;BR /&gt;
is it possible ?&lt;BR /&gt;
because for the moment, i work like that but if there is a shorter and easier way to do it, it would be nice&lt;BR /&gt;
here is my code:&lt;BR /&gt;
&lt;BR /&gt;
data class;&lt;BR /&gt;
 set sashelp.class end=fin;&lt;BR /&gt;
 x_1= _n_ * 3;&lt;BR /&gt;
 y_1= _n_ * 3;&lt;BR /&gt;
 weight=weight/2;&lt;BR /&gt;
 if _n_ = 1 then do;; x_1=0; y_1=0; end;&lt;BR /&gt;
 if fin then do; x_1=80; y_1=80; end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
goptions reset=all; &lt;BR /&gt;
title 'is there a shorter way ???';&lt;BR /&gt;
&lt;BR /&gt;
symbol1 color=red&lt;BR /&gt;
        interpol=join&lt;BR /&gt;
        value=dot&lt;BR /&gt;
        height=3;&lt;BR /&gt;
&lt;BR /&gt;
symbol2  value=none&lt;BR /&gt;
        color=black&lt;BR /&gt;
        interpol=join&lt;BR /&gt;
        height=2;&lt;BR /&gt;
&lt;BR /&gt;
axis1 order=(0 to 100 by 20) offset=(0,0)&lt;BR /&gt;
      label=none&lt;BR /&gt;
      major=(height=2) minor=(height=1)&lt;BR /&gt;
      width=3;&lt;BR /&gt;
&lt;BR /&gt;
axis2 order=(0 to 100 by 20)  offset=(0,0)&lt;BR /&gt;
      label=none&lt;BR /&gt;
      major=(height=2) minor=(height=1)&lt;BR /&gt;
      width=3;&lt;BR /&gt;
&lt;BR /&gt;
proc gplot data=class;&lt;BR /&gt;
  plot height*weight x_1*y_1 / overlay  haxis=axis1  vaxis=axis2 ;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
may be is a dream but it would be very nice if the following code exists;&lt;BR /&gt;
&lt;BR /&gt;
proc gplot data=sashelp.class;&lt;BR /&gt;
  plot height*weight;&lt;BR /&gt;
  equation Y=X;   (this isn't exist yet)&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much for yours answers.</description>
      <pubDate>Thu, 26 Nov 2009 16:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22608#M598</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-11-26T16:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: adding an equation to draw to a plot statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22609#M599</link>
      <description>The alternative is to use annotation, but that's not simpler.&lt;BR /&gt;
&lt;BR /&gt;
This allows to manage the 2 plots' data separately:&lt;BR /&gt;
&lt;BR /&gt;
data class;&lt;BR /&gt;
set sashelp.class;&lt;BR /&gt;
weight=weight/2;&lt;BR /&gt;
output;&lt;BR /&gt;
if _n_ = 1 then do; &lt;BR /&gt;
  do x_1=0 to 100 by 5;&lt;BR /&gt;
    y_1=x_1**1.2 - 1.5*x - 5 ;&lt;BR /&gt;
    output;&lt;BR /&gt;
  end;&lt;BR /&gt;
end;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 26 Nov 2009 23:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22609#M599</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-11-26T23:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: adding an equation to draw to a plot statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22610#M600</link>
      <description>If you're doing a regression like, you can use the 'regeqn' gplot option, such as:&lt;BR /&gt;
&lt;BR /&gt;
symbol1 interpol=rcclm95 value=circle cv=red ci=pink co=blue;&lt;BR /&gt;
proc gplot data=sashelp.class;&lt;BR /&gt;
   plot height*weight=1 / regeqn;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
-----&lt;BR /&gt;
&lt;BR /&gt;
Otherwise, you can use the 'note' option to print some text (equation) such as:&lt;BR /&gt;
&lt;BR /&gt;
symbol v=dot i=none;&lt;BR /&gt;
proc gplot data=sashelp.class;&lt;BR /&gt;
plot height*weight;&lt;BR /&gt;
note move=(20,80)pct c=blue height=3.5pct font="arial" 'Y=X';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
-----&lt;BR /&gt;
&lt;BR /&gt;
If the equation doesn't have to be on the graph itself, you can put some text in a&lt;BR /&gt;
'title2' or a 'footnote' statement.&lt;BR /&gt;
&lt;BR /&gt;
And, of course, you could annotate some text for the equation.&lt;BR /&gt;
&lt;BR /&gt;
And, if the equation doesn't lend itself to a simple single line of text, you could&lt;BR /&gt;
create a jpg image containing the equation (created using a fancy word-processor&lt;BR /&gt;
or other tool) and then annotate that image onto the graph.&lt;BR /&gt;
&lt;BR /&gt;
-----</description>
      <pubDate>Mon, 30 Nov 2009 20:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22610#M600</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2009-11-30T20:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: adding an equation to draw to a plot statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22611#M601</link>
      <description>Thank you for yours answers</description>
      <pubDate>Fri, 04 Dec 2009 14:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/adding-an-equation-to-draw-to-a-plot-statement/m-p/22611#M601</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-04T14:24:24Z</dc:date>
    </item>
  </channel>
</rss>

