<?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: Linear Regression Parameters in SAS EG in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201207#M37605</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to transpose your data&lt;/P&gt;&lt;P&gt;Tasks&amp;gt;Data&amp;gt;Transpose&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is because SAS expects your data to be in the form&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X Y&lt;/P&gt;&lt;P&gt;12 2&lt;/P&gt;&lt;P&gt;13 1.5&lt;/P&gt;&lt;P&gt;14 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use linear regression, Task&amp;gt;Regression&amp;gt;Linear Regression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Jul 2015 16:48:41 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-07-13T16:48:41Z</dc:date>
    <item>
      <title>Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201206#M37604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;I am trying to duplicate the Excel LINEST function in a SAS EG project.&amp;nbsp; This Excel function returns the "slope of best fit" using the "Least Square Reqression Line Equation" method.&amp;nbsp; I do not need to produce a graph, but only the numerical value of the slope as denoted in the Excel results.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;The table has 4 fields;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 14pt;"&gt;Name of Agency&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;As an example., here are values in the 12, 13, and 14 fields:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 14pt; line-height: 1.5em;"&gt;12: 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 14pt; line-height: 1.5em;"&gt;13: 1.5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 14pt; line-height: 1.5em;"&gt;14: 3&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;In the Excel file the LINEST function returns a slope value of.5 for these three data points.&amp;nbsp; I need help:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 14pt;"&gt;1. Determining which SAS EG Regression function will duplicate these calculations&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 14pt;"&gt;2. Assistance in how to enter the field names into the function itself (Dependent variable, Explanatory variable, etc.).&amp;nbsp; I had no luck using the "noodle around" method of problem-solving.&amp;nbsp; &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;Thanks &lt;STRONG&gt;&lt;EM&gt;so&lt;/EM&gt;&lt;/STRONG&gt; much for&amp;nbsp; assistance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt;"&gt;William&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 15:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201206#M37604</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-13T15:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201207#M37605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to transpose your data&lt;/P&gt;&lt;P&gt;Tasks&amp;gt;Data&amp;gt;Transpose&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is because SAS expects your data to be in the form&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X Y&lt;/P&gt;&lt;P&gt;12 2&lt;/P&gt;&lt;P&gt;13 1.5&lt;/P&gt;&lt;P&gt;14 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use linear regression, Task&amp;gt;Regression&amp;gt;Linear Regression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 16:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201207#M37605</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-13T16:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201208#M37606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I re-formatted the data to match your recommendation.&amp;nbsp; This yields three variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Name_of_Agency X Y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the data in Analysis&amp;gt;Linear Regression but the results clearly show I have not entered the variables in the correct spots in the Linear Regression Data window.&amp;nbsp; The Dependent Variable appears to require a number since it will not accept the Name_of_Agency variable.&amp;nbsp; I have tried various combinations of these three variables, but none produces a slope of line value based on the X and Y data for the agencies.&amp;nbsp; Ideas?&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS.&amp;nbsp; I had to &lt;STRONG&gt;&lt;EM&gt;stack&lt;/EM&gt;&lt;/STRONG&gt; the data to create the X and Y variables in the format you provided above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 18:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201208#M37606</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-13T18:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201209#M37607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forget what excel did/does. &lt;/P&gt;&lt;P&gt;What are you trying to achieve? Name of Agency is a character variable and it makes sense that you can't perform a regression using a character variable. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 19:32:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201209#M37607</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-13T19:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201210#M37608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to get SAS to return a numerical value representing the slope of best fit based on three data points for a list of agencies.&amp;nbsp; Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Agency&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;13&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;14&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Slope&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;Briarwood&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD&gt;-0.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Tinseltown&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1.5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2.5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;.75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Woodcreek&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Ashton&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3.5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-.75&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The numbers in the Slope column are "real" based on the three data points and using the "Least Squares" method of calculating slope of line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 11:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201210#M37608</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-14T11:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201211#M37609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tasks&amp;gt;Data&amp;gt;Transpose&lt;/P&gt;&lt;P&gt;Transpose variables - 12/13/14&lt;/P&gt;&lt;P&gt;Group Analysis by Agency&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you'll have&lt;/P&gt;&lt;P&gt;Briarwood 12 2&lt;/P&gt;&lt;P&gt;Briarwood 13 3&lt;/P&gt;&lt;P&gt;Briarwood 14 1&lt;/P&gt;&lt;P&gt;Tinseltown 12 1.5&lt;/P&gt;&lt;P&gt;Tinseltown 13 2.5&lt;/P&gt;&lt;P&gt;Tinseltown 14 3&lt;/P&gt;&lt;P&gt;Woodcreek 12 4&lt;/P&gt;&lt;P&gt;Woodcreek 13 3&lt;/P&gt;&lt;P&gt;Woodcreek 14 2&lt;/P&gt;&lt;P&gt;Ashton 12 3.5&lt;/P&gt;&lt;P&gt;Ashton 13 1&lt;/P&gt;&lt;P&gt;Ashton 14 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Except for the fact that 12/13/14 are character because variable names are always character. They may have an underscore in front as well. &lt;/P&gt;&lt;P&gt;Use Query Builder to convert to numeric in a calculated column. In my case I had an underscore in front of the name so I used input(compress(source, "_"), 2.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then Use Linear Regression with&lt;/P&gt;&lt;P&gt;Dependent as Y (12, 13, 14)&lt;/P&gt;&lt;P&gt;Explanatory as X (2, 3, 1)&lt;/P&gt;&lt;P&gt;Group by as Agency&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 14:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201211#M37609</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-14T14:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201212#M37610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!!&amp;nbsp; Your instructions were A+ in clarity and accuracy.&amp;nbsp; The Linear Regression object is now running without issue.&amp;nbsp; Really, really appreciate you hanging in on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I googled this topic upside down and sideways and the only articles I found were for Base SAS, not SAS EG.&amp;nbsp; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Might I ask how you knew this? &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 16:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201212#M37610</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-14T16:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201213#M37611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did think of one more related issue I'm stumped on.&amp;nbsp; The results look like a One-Way Freq page (SAS Report).&amp;nbsp; Unlike the latter, however, there does not appear to be a "Results" option that will create a data table.&amp;nbsp; Is it possible to specify a data table format?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 17:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201213#M37611</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-14T17:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201214#M37612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Welcome to the stage where EG gets you 90% there and then ...&lt;/P&gt;&lt;P&gt;At least in my version, EG 5.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do it via code. Determine the name of your dataset and modify appropriately:&lt;/P&gt;&lt;P&gt;I may have had the X/Y backwards in my initial instructions by the way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;by agency;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc reg data=have;&lt;/P&gt;&lt;P&gt;by agency;&lt;/P&gt;&lt;P&gt;model y=x;&lt;/P&gt;&lt;P&gt;ods output parameterestimates=want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 17:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201214#M37612</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-14T17:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201215#M37613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, they were backwards.&amp;nbsp; When the results didn't match the Excel output I knew there was an issue.&amp;nbsp; I switched the X and Y roles and the results were identical to Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the code.&amp;nbsp; I will post once I've had a chance to try it out.&amp;nbsp; Thanks much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 18:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201215#M37613</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-14T18:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Linear Regression Parameters in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201216#M37614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yea, success!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This thread has excellent guidance that took a good deal of valuable time and effort on your part--what a superlative effort to help a complete stranger.&amp;nbsp; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;I would have never figured this out on my own.&amp;nbsp; &lt;/SPAN&gt;THANKS!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2015 13:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Linear-Regression-Parameters-in-SAS-EG/m-p/201216#M37614</guid>
      <dc:creator>LiamRowan</dc:creator>
      <dc:date>2015-07-15T13:22:36Z</dc:date>
    </item>
  </channel>
</rss>

