<?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: Find the residuals from a firm fixed effects regression in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Find-the-residuals-from-a-firm-fixed-effects-regression/m-p/599754#M76320</link>
    <description>&lt;P&gt;You have class variables that are not in the model. Delete the CLASS statement, try it again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add the class variables into the model, and get rid of the BY statement, try it again.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2019 11:01:45 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-10-28T11:01:45Z</dc:date>
    <item>
      <title>Find the residuals from a firm fixed effects regression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Find-the-residuals-from-a-firm-fixed-effects-regression/m-p/599751#M76319</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running the a firm fixed effect regression to find the residual, but the error message says my CLASS variable has only one level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My regression has only one independent variable which I call it 'independent_variable_TACC', and the dependent variable is&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; 'dependent variable_BTD'. I used PROC REG to get residuals before by adding a '/r' after MODEL command, but it seems like PROC GLM does not work in that way.&amp;nbsp;&lt;SPAN style="background-color: #ffffff; color: #333333; cursor: text; display: inline; float: none; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.2; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;I attached my codes herewith. I am not sure if I need to add both firm_code (gvkey) and year (fyear) in CLASS or only firm_code is needed.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Can anyone tell me how do I get the residual from a&amp;nbsp;firm fixed effect regression? &lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;I really appreciate for any help with this problem. Thanks a lot in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=rep.DD_BTD_regression;
class gvkey fyear; /*firm fixed effect*/
model dependent_variable_BTD=independent_variable_TACC; 
by gvkey fyear;
output out=rep.DD_BTD_residuals /*new data set with residual*/
      r=DD_BTD_resid; /*the residual I need*/
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Jiaxin&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 10:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Find-the-residuals-from-a-firm-fixed-effects-regression/m-p/599751#M76319</guid>
      <dc:creator>jiaxinyang</dc:creator>
      <dc:date>2019-10-28T10:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Find the residuals from a firm fixed effects regression</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Find-the-residuals-from-a-firm-fixed-effects-regression/m-p/599754#M76320</link>
      <description>&lt;P&gt;You have class variables that are not in the model. Delete the CLASS statement, try it again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add the class variables into the model, and get rid of the BY statement, try it again.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 11:01:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Find-the-residuals-from-a-firm-fixed-effects-regression/m-p/599754#M76320</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-28T11:01:45Z</dc:date>
    </item>
  </channel>
</rss>

