<?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: How to use rolling regression and calculate the skewness of residuals in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180202#M45947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I actually figured out one way to do it by just mergeing&amp;nbsp; _outest_ds with _iskewness. This step simply adds iskewness to the _outest_ds&lt;/P&gt;&lt;P&gt;The program is like:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; proc reg data=ABC noprint outest=_outest_ds;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; by permno;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; model exret=mktrf smb umd hml;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; output out=_residues r=r;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; proc univariate data=_residues;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; by permno;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; var r;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; output out=_iskewness mean=mu skewness=iskew;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _outest_ds; merge _outest_ds _iskewness; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested the answer alr so this works.&lt;/P&gt;&lt;P&gt;The program is very useful to calculate idiosyncratic skewness.&lt;/P&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Dec 2013 14:25:57 GMT</pubDate>
    <dc:creator>DennisLe</dc:creator>
    <dc:date>2013-12-23T14:25:57Z</dc:date>
    <item>
      <title>How to use rolling regression and calculate the skewness of residuals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180200#M45945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to modify a rolling regression macro to calculate the idiosyncratic skewness of stocks. Basically it is the skewness of residuals after the regression.&lt;/P&gt;&lt;P&gt;However, I am not very sure how to change the code and export out the skewness to match each permno. The data used is CRSP so it's quite inconvenient to post here.&lt;/P&gt;&lt;P&gt;My macro for rolling regression can be found here and it is quite easy to use: (though right now it cannot be used to calculate the skewness)&lt;/P&gt;&lt;P&gt;&lt;CITE class="vurls" style="color: #006621; font-style: normal; font-size: 14px; font-family: arial, sans-serif; background-color: #ffffff;"&gt;www.nesug.org/proceedings/nesug07/sa/sa04.pdf&lt;/CITE&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;‎&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;I am able to calculate the skewness for each stock individually using the code below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc reg data=ABC noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by permno;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; model exret=mktrf smb umd hml;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; output out=_residues r=r;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc univariate data=_residues;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by permno;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var r;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=_iskewness mean=mu skewness=iskew;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this code is hard to add into the macro because im not sure how to match the output above with the respective permno.&lt;/P&gt;&lt;P&gt;I attach the macro here for easy reference. Thanks in advance for any idea &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Dec 2013 12:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180200#M45945</guid>
      <dc:creator>DennisLe</dc:creator>
      <dc:date>2013-12-22T12:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rolling regression and calculate the skewness of residuals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180201#M45946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dennis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would think that the variable permno would be included on the dataset _iskewness, due to the BY statement (see OUTPUT statment documentation for PROC UNIVARIATE).&amp;nbsp; You have &amp;amp;by_id defined in your macro, but I couldn't find permno.&amp;nbsp; If the two are referring to the same thing, then just substitute &amp;amp;by_id into the above code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope I'm not completely misinterpreting what you are trying to do here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Dec 2013 13:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180201#M45946</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2013-12-23T13:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use rolling regression and calculate the skewness of residuals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180202#M45947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I actually figured out one way to do it by just mergeing&amp;nbsp; _outest_ds with _iskewness. This step simply adds iskewness to the _outest_ds&lt;/P&gt;&lt;P&gt;The program is like:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; proc reg data=ABC noprint outest=_outest_ds;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; by permno;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; model exret=mktrf smb umd hml;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; output out=_residues r=r;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; proc univariate data=_residues;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; by permno;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; var r;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; output out=_iskewness mean=mu skewness=iskew;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _outest_ds; merge _outest_ds _iskewness; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested the answer alr so this works.&lt;/P&gt;&lt;P&gt;The program is very useful to calculate idiosyncratic skewness.&lt;/P&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dennis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Dec 2013 14:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-rolling-regression-and-calculate-the-skewness-of/m-p/180202#M45947</guid>
      <dc:creator>DennisLe</dc:creator>
      <dc:date>2013-12-23T14:25:57Z</dc:date>
    </item>
  </channel>
</rss>

