<?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 Discretionary Accruals SAS Code Question in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Discretionary-Accruals-SAS-Code-Question/m-p/375562#M19683</link>
    <description>&lt;P&gt;Hi, I am a SAS beginner, and&amp;nbsp;trying to figure out the SAS code for discretionary accruals. I borrowed some SAS code from&amp;nbsp;&lt;A href="http://codegists.com/snippet/sas/earnings_management_modelssas_joostimpink_sas" target="_blank"&gt;http://codegists.com/snippet/sas/earnings_management_modelssas_joostimpink_sas&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I construct all variables and winsorize them. Then I use the following code to calculate the discretionary accruals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Regression by industry-year&lt;BR /&gt;edf + #params (4) will equal the number of obs (no need for proc univariate to count) */&lt;BR /&gt;proc sort data=Da.Da2_winsor; by fyear sic2;run;&lt;BR /&gt;proc reg data=Da.Da2_winsor noprint edf outest=Da.Da2_parms;&lt;BR /&gt;model wtac = wdrev wppe wroa; /* Kothari with ROA in model */&lt;BR /&gt;by fyear sic2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data Da.Da2_parms; Set Da.Da2_parms;&lt;BR /&gt;rename wdrev=wdrev_parm wppe=wppe_parm wroa=wroa_parm;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*To merge the parameters into the main dataset;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table Da.Da3 as select *&lt;BR /&gt;from Da.Da2_winsor as a left join Da.Da2_parms as b&lt;BR /&gt;on a.fyear=b.fyear and a.SIC2=b.SIC2;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Da.Da3; Set Da.Da3;&lt;BR /&gt;tac_pdt = intercept + wdrev*wdrev_parm + wppe*wppe_parm + wroa*wroa_parm;&lt;BR /&gt;ADA = abs(tac-tac_pdt);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results of this SAS code are close to the results from a paper, but there are still some difference. I do not know whether this difference is from some errors of the code. I have two questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I wonder if the codes above look right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Does the the following SAS code give us the parameters and the intercepts for regressions of different years and different industries?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/* Regression by industry-year&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;edf + #params (4) will equal the number of obs (no need for proc univariate to count) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;proc sort data=Da.Da2_winsor; by fyear sic2;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;proc reg data=Da.Da2_winsor noprint edf outest=Da.Da2_parms;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;model wtac = wdrev wppe wroa; /* Kothari with ROA in model */&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;by fyear sic2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2017 05:14:01 GMT</pubDate>
    <dc:creator>TerryC</dc:creator>
    <dc:date>2017-07-13T05:14:01Z</dc:date>
    <item>
      <title>Discretionary Accruals SAS Code Question</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Discretionary-Accruals-SAS-Code-Question/m-p/375562#M19683</link>
      <description>&lt;P&gt;Hi, I am a SAS beginner, and&amp;nbsp;trying to figure out the SAS code for discretionary accruals. I borrowed some SAS code from&amp;nbsp;&lt;A href="http://codegists.com/snippet/sas/earnings_management_modelssas_joostimpink_sas" target="_blank"&gt;http://codegists.com/snippet/sas/earnings_management_modelssas_joostimpink_sas&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I construct all variables and winsorize them. Then I use the following code to calculate the discretionary accruals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Regression by industry-year&lt;BR /&gt;edf + #params (4) will equal the number of obs (no need for proc univariate to count) */&lt;BR /&gt;proc sort data=Da.Da2_winsor; by fyear sic2;run;&lt;BR /&gt;proc reg data=Da.Da2_winsor noprint edf outest=Da.Da2_parms;&lt;BR /&gt;model wtac = wdrev wppe wroa; /* Kothari with ROA in model */&lt;BR /&gt;by fyear sic2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data Da.Da2_parms; Set Da.Da2_parms;&lt;BR /&gt;rename wdrev=wdrev_parm wppe=wppe_parm wroa=wroa_parm;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*To merge the parameters into the main dataset;&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table Da.Da3 as select *&lt;BR /&gt;from Da.Da2_winsor as a left join Da.Da2_parms as b&lt;BR /&gt;on a.fyear=b.fyear and a.SIC2=b.SIC2;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Da.Da3; Set Da.Da3;&lt;BR /&gt;tac_pdt = intercept + wdrev*wdrev_parm + wppe*wppe_parm + wroa*wroa_parm;&lt;BR /&gt;ADA = abs(tac-tac_pdt);&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The results of this SAS code are close to the results from a paper, but there are still some difference. I do not know whether this difference is from some errors of the code. I have two questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I wonder if the codes above look right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Does the the following SAS code give us the parameters and the intercepts for regressions of different years and different industries?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/* Regression by industry-year&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;edf + #params (4) will equal the number of obs (no need for proc univariate to count) */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;proc sort data=Da.Da2_winsor; by fyear sic2;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;proc reg data=Da.Da2_winsor noprint edf outest=Da.Da2_parms;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;model wtac = wdrev wppe wroa; /* Kothari with ROA in model */&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;by fyear sic2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 05:14:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Discretionary-Accruals-SAS-Code-Question/m-p/375562#M19683</guid>
      <dc:creator>TerryC</dc:creator>
      <dc:date>2017-07-13T05:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Discretionary Accruals SAS Code Question</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Discretionary-Accruals-SAS-Code-Question/m-p/375572#M19684</link>
      <description>&lt;P&gt;I moved your question to the SAS STAT community, as it is mainly about proc reg.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As advice for the beginner: give your code visual structure, this makes it easier to read, understand and maintain:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Regression by industry-year
edf + #params (4) will equal the number of obs (no need for proc univariate to count) */

proc sort data=Da.Da2_winsor;
by fyear sic2;
run;

proc reg
  data=Da.Da2_winsor
  noprint
  edf
  outest=Da.Da2_parms
;
model wtac = wdrev wppe wroa; /* Kothari with ROA in model */
by fyear sic2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that I posted the code using the "little running man" (7th) icon, which invokes a fixed-font window that does format code close to what the enhanced editor in SAS does.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 06:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Discretionary-Accruals-SAS-Code-Question/m-p/375572#M19684</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-13T06:38:07Z</dc:date>
    </item>
  </channel>
</rss>

