<?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: Slope and Intercept. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24586#M5566</link>
    <description>This seems to work.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data one;&lt;BR /&gt;
   do x = 1 to 4, 3.3;&lt;BR /&gt;
      input y @;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   cards;&lt;BR /&gt;
1.5 1.6 2.1 3.0 .&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc reg data=one;&lt;BR /&gt;
   model y = x; &lt;BR /&gt;
   output out=p p=p r=r;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc summary data=one;&lt;BR /&gt;
   where not missing(y) and not missing(x);&lt;BR /&gt;
   output&lt;BR /&gt;
      out      =  sums(drop=_:) &lt;BR /&gt;
      n(x)     =  n &lt;BR /&gt;
      sum(x y) =  sx sy&lt;BR /&gt;
      uss(x)   =  uss&lt;BR /&gt;
      ;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc summary data=one;&lt;BR /&gt;
   where not missing(y) and not missing(x);&lt;BR /&gt;
   weight x;&lt;BR /&gt;
   output out=sxy(drop=_:) sum(y)=sxy;&lt;BR /&gt;
   run;&lt;BR /&gt;
       &lt;BR /&gt;
data pred;&lt;BR /&gt;
   set one;&lt;BR /&gt;
   if _n_ eq 1 then do;&lt;BR /&gt;
      set sums;&lt;BR /&gt;
      set sxy;&lt;BR /&gt;
      retain b i;&lt;BR /&gt;
      b = (n*sxy - sx*sy) / (n*uss - sx**2);&lt;BR /&gt;
      i = (sy - b*sx) / n;&lt;BR /&gt;
      end;&lt;BR /&gt;
   p = i + x*b;&lt;BR /&gt;
   r = y - p;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Tue, 28 Apr 2009 21:12:06 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2009-04-28T21:12:06Z</dc:date>
    <item>
      <title>Slope and Intercept.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24584#M5564</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have two column values X and Y. Is there a way to find the slope and the intercept of column X and Y. Something which is equivalent to slope(y1:y100,x1:x100) in excel.&lt;BR /&gt;
&lt;BR /&gt;
I do not have a regression model. I just have the data set with these two columns and I need to compute the slope and intercept for these two columns.&lt;BR /&gt;
&lt;BR /&gt;
Is there a way in SAS to do this?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any small help you render.</description>
      <pubDate>Tue, 28 Apr 2009 19:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24584#M5564</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-28T19:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24585#M5565</link>
      <description>You can get it directly from PROC REG.  You can get it indirectly from PROC CORR (you'll need a regression and correlation text to do the crosswalk).  CORR is part of the Base SAS, so you should have that procedure even if you don't have SAS/Stat.&lt;BR /&gt;
&lt;BR /&gt;
There are other ways to get it from SAS, but these are the most direct.</description>
      <pubDate>Tue, 28 Apr 2009 19:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24585#M5565</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2009-04-28T19:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24586#M5566</link>
      <description>This seems to work.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data one;&lt;BR /&gt;
   do x = 1 to 4, 3.3;&lt;BR /&gt;
      input y @;&lt;BR /&gt;
      output;&lt;BR /&gt;
      end;&lt;BR /&gt;
   cards;&lt;BR /&gt;
1.5 1.6 2.1 3.0 .&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc reg data=one;&lt;BR /&gt;
   model y = x; &lt;BR /&gt;
   output out=p p=p r=r;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc summary data=one;&lt;BR /&gt;
   where not missing(y) and not missing(x);&lt;BR /&gt;
   output&lt;BR /&gt;
      out      =  sums(drop=_:) &lt;BR /&gt;
      n(x)     =  n &lt;BR /&gt;
      sum(x y) =  sx sy&lt;BR /&gt;
      uss(x)   =  uss&lt;BR /&gt;
      ;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc summary data=one;&lt;BR /&gt;
   where not missing(y) and not missing(x);&lt;BR /&gt;
   weight x;&lt;BR /&gt;
   output out=sxy(drop=_:) sum(y)=sxy;&lt;BR /&gt;
   run;&lt;BR /&gt;
       &lt;BR /&gt;
data pred;&lt;BR /&gt;
   set one;&lt;BR /&gt;
   if _n_ eq 1 then do;&lt;BR /&gt;
      set sums;&lt;BR /&gt;
      set sxy;&lt;BR /&gt;
      retain b i;&lt;BR /&gt;
      b = (n*sxy - sx*sy) / (n*uss - sx**2);&lt;BR /&gt;
      i = (sy - b*sx) / n;&lt;BR /&gt;
      end;&lt;BR /&gt;
   p = i + x*b;&lt;BR /&gt;
   r = y - p;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 28 Apr 2009 21:12:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24586#M5566</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-04-28T21:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24587#M5567</link>
      <description>But I do not have proc reg installed. I do not know how to figure out. When I try running it with proc reg the log says procedure reg not found.&lt;BR /&gt;
&lt;BR /&gt;
Is there any alternate way of doing this?</description>
      <pubDate>Tue, 28 Apr 2009 21:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24587#M5567</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-28T21:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24588#M5568</link>
      <description>The PROC REG in my program was for me to check my calculations.  Just remove it.</description>
      <pubDate>Tue, 28 Apr 2009 23:06:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24588#M5568</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-04-28T23:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Slope and Intercept.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24589#M5569</link>
      <description>You can also run a proc gplot with a symbol i=rl statement.  The slope / intercept info is posted in the log window.&lt;BR /&gt;
&lt;BR /&gt;
86   data test;&lt;BR /&gt;
87   input a b;&lt;BR /&gt;
88   datalines;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The data set WORK.TEST has 4 observations and 2 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.03 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
93   ;&lt;BR /&gt;
94&lt;BR /&gt;
95   goptions dev=win;&lt;BR /&gt;
96   symbol1 i=rl;&lt;BR /&gt;
97   proc gplot data=test;&lt;BR /&gt;
98   plot a*b=1;&lt;BR /&gt;
99   run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Regression equation :  a =  1.311793 + 0.483037*b.&lt;BR /&gt;
100  quit;</description>
      <pubDate>Mon, 04 May 2009 13:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Slope-and-Intercept/m-p/24589#M5569</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2009-05-04T13:58:59Z</dc:date>
    </item>
  </channel>
</rss>

