<?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 Calculation in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78998#M7801</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the forum question, your question fit here or it could have fit on the Stat Procedures forum.&amp;nbsp; I made the side comment because many analysts (as opposed to stat programmers) need to use the GUI because they aren't very knowledgeable coders.&amp;nbsp; EGuide is getting more "programmer friendly," though you will see from some other posts that many think it has a ways to go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jun 2012 14:47:10 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2012-06-13T14:47:10Z</dc:date>
    <item>
      <title>Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78990#M7793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attached file is a small subset of my large data file.&amp;nbsp; It is the data for one employee over months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column A = Month the work was completed&lt;/P&gt;&lt;P&gt;Column B = An integer assigned to the month - this is used to calculate the slope via excel&lt;/P&gt;&lt;P&gt;Column C = Employee #.&lt;/P&gt;&lt;P&gt;Column L = The slope I calculated in Excel.&amp;nbsp; The formula is:&amp;nbsp; =SLOPE(IF($C$2:$C$25000=C2,$M$2:$M$25000),IF($C$2:$C$25000=C2,$B$2:$B$25000))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I mentioned the excel file is quite large. Thus, it is a very slow to try to calculate the slope with these many data rows and I hope to be able to do this in SAS EG.&amp;nbsp; I am looking for help / direction on how to calculate the SLOPE in SAS EG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are up to 12-months worth of data for each employee.&amp;nbsp; I would like to be able to write a program that says, for each employee_ID, take the monthly_weighted_approval_rate for all the months the employee worked and calculate the slope, and, if possible, the R-Square.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I researched the forum and found PROC REG and PROC GLM, but frankly I do not know where to how to start with these.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jenne&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 20:24:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78990#M7793</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2012-06-08T20:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78991#M7794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your workbook has only 70 lines of non missing data. This is how to do the regressions with proc reg :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;libname xl excel "&amp;amp;SASForum.\datasets\slope.xls";&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;/* Keep a single value of Monthly_Weighted_Approval per month */&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;create table test as&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;select Emp_ID, Event_month, mean(Monthly_Weighted_Approval) as MWA&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;from xl.'sheet2$'n&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;where Monthly_Weighted_Approval is not missing&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;group by Emp_ID, Event_month;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;libname xl clear;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;/* Do the regression, request output statistics in PE and FS datasets */&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc reg data=test;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;by Emp_ID notsorted;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;model MWA = Event_Month;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;ods output parameterEstimates=PE FitStatistics=FS;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;/* Join statistics into a table. &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; Multiply the slope by 30 to express it per month */&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;create table stats as&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;select PE.Emp_ID, PE.Estimate*30 as slope, PE.ProbT, FS.nValue2 as AdjRSquare&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;from PE, FS&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;where pe.Emp_ID=fs.Emp_ID and PE.Variable="Event_Month" and FS.Label2="Adj R-Sq";&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;select * from stats;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;STRONG&gt;PG&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Corrected by PG (replaced divide by multiply)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2012 20:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78991#M7794</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-06-09T20:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78992#M7795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you PGStats!&amp;nbsp; Your response is very helpful and gives me the other stats I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when ran, I am not getting the same answer had I calculated manually via excel formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp; The slope in table STATS is different compared to the result using the excel formula:&amp;nbsp; =SLOPE(IF($C$2:C$45=C2,$L$2:$L$45),IF($C$2:$C$45=C2,$B$2:$B$45))&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using the Excel formula, slope = -0.0185881530393469&lt;/LI&gt;&lt;LI&gt;Using the code above, the slope = -0.000023351791:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 424px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="17" width="85"&gt;OPR_ID&lt;/TD&gt;&lt;TD class="xl65" width="153"&gt;slope&lt;/TD&gt;&lt;TD width="86"&gt;Probt&lt;/TD&gt;&lt;TD width="100"&gt;AdjRSquare&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="17"&gt;abc123&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;-0.000023351791&lt;/TD&gt;&lt;TD align="right"&gt;0.04577284&lt;/TD&gt;&lt;TD align="right"&gt;0.4313875&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; "Divide the slope by 30 to express it per month" -&amp;nbsp; Why is this done?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2012 19:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78992#M7795</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2012-06-12T19:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78993#M7796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops, major oops! Sorry. It should be MULTIPLIED by 30. I already did the correction in the code pasted above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable Event_month is imported as a SAS date which is expressed in days. The slope from the MWA = Event_Month regression is thus expressed in MWA per day. MWA per month is thus 30 times as much. You shouldn't expect the slopes to be exactly the same as your Excel regression is on a varying number of observations every month. In my suggested code, only one value is kept per month. The two slopes should be close though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2012 20:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78993#M7796</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-06-12T20:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78994#M7797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PG - This worked!&amp;nbsp; Thank you!&amp;nbsp; Few more follow up questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; What is Adjusted R-Square?&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; What is the code to calculate R-Sqare instead of AR2?&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; I got this warning when I ran the /* Do the regression, request output statistics in PE and FS datasets */ portion of the code.&amp;nbsp; Thoughts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: The range of variable Event_Month is so small relative to its mean that there may be loss of accuracy in the computations. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You may need to rescale the variable to have a larger value of RANGE/abs(MEAN), for example, by using PROC STANDARD M=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2012 12:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78994#M7797</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2012-06-13T12:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78995#M7798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adjusted R-Squared is the R-squared penalized for the number of variable in the model.&amp;nbsp; When you have just one predictor, I recall it as being the same as R-Squared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The formula's for both are in the PROC REG documentation on support.sas.com.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, since you posted this to the EGuide forum, you can do the pieces that PG described using the EGuide GUI as well as with code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2012 13:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78995#M7798</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-06-13T13:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78996#M7799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Duke,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the direction to the support.sas.com documentation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the code that PG described, I was able to get a slope very close to the one calculated via excel.&amp;nbsp; However, the R-squared I got from the Linear Regression via excel and the Adjusted R-Squared from PG's code are very different.&amp;nbsp; I will see if I can find the code in the documentation and then do a comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't tried the process via the EG GUI interface yet.&amp;nbsp; My project process is via the GUI except the slope calculation.&amp;nbsp; I am on a time crunch to get this done for work, but will try it via the GUI later in the week and let you know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2012 13:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78996#M7799</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2012-06-13T13:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78997#M7800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Duke - Did I mess up and should have posted my question to a different forum?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2012 14:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78997#M7800</guid>
      <dc:creator>jen123</dc:creator>
      <dc:date>2012-06-13T14:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78998#M7801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the forum question, your question fit here or it could have fit on the Stat Procedures forum.&amp;nbsp; I made the side comment because many analysts (as opposed to stat programmers) need to use the GUI because they aren't very knowledgeable coders.&amp;nbsp; EGuide is getting more "programmer friendly," though you will see from some other posts that many think it has a ways to go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2012 14:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78998#M7801</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-06-13T14:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Slope Calculation</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78999#M7802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess question 1 was already answered. As for question 2 and 3, the following version including calculations with and without duplicate&lt;/P&gt;&lt;P&gt;monthly weighted approval rates should answer :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;libname xl excel "&amp;amp;SASForum.\datasets\slope.xls";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;/* Flag the first observation of every month (variable first). &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Express the month as the number of months since the beginning of the century to avoid&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;loss of accuracy */ &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;data test(keep=Emp_ID month Monthly_Weighted_Approval first);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;set xl.'sheet2$'n;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;by Event_month notsorted;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;if Monthly_Weighted_Approval ne .;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;first = first.Event_month;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;month = intck("MONTH", '01JAN2000'd, Event_Month);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;libname xl clear;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;/* Do the regression on a single observation per month, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;request output statistics in PEfirst and FSfirst datasets */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc reg data=test(where=(first)) plots=none;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;by Emp_ID notsorted;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;model Monthly_Weighted_Approval = month;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;ods output parameterEstimates=PEfirst FitStatistics=FSfirst;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;/* Do the regression on all duplicate observations, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;request output statistics in PEall and FSall datasets */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc reg data=test plots=none;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;by Emp_ID notsorted;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;model Monthly_Weighted_Approval = month;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;ods output parameterEstimates=PEall FitStatistics=FSall;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;/* Join statistics into tables. */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc sql;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;create table statsFirst as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select PE.Emp_ID, PE.Estimate as slope, PE.ProbT, FS.nValue2 as RSquare&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;from PEfirst as PE, FSfirst as FS&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;where pe.Emp_ID=fs.Emp_ID and PE.Variable="Month" and FS.Label2="R-Square";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;create table statsAll as&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select PE.Emp_ID, PE.Estimate as slope, PE.ProbT, FS.nValue2 as RSquare&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;from PEall as PE, FSall as FS&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;where pe.Emp_ID=fs.Emp_ID and PE.Variable="Month" and FS.Label2="R-Square";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;title "One observation per month";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select * from statsFirst;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;title "All duplicate observations";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;select * from statsAll;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;PG&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2012 21:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Slope-Calculation/m-p/78999#M7802</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-06-13T21:49:25Z</dc:date>
    </item>
  </channel>
</rss>

