07-19-2017 02:43 AM
Hi, I am a SAS beginner, and trying to figure out the SAS code for discretionary accruals. I borrowed some SAS code from http://codegists.com/snippet/sas/earnings_management_modelssas_joostimpink_sas.
First, I construct all variables and winsorize them. Then I use the following code to calculate the discretionary accruals.
/* 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;
proc reg data=Da.Da2_winsor
outest=Da.Da2_parms; model wtac = wdrev wppe wroa; /* Kothari with ROA in model */ by fyear sic2; run; data Da.Da2_parms; Set Da.Da2_parms; rename wdrev=wdrev_parm wppe=wppe_parm wroa=wroa_parm; run; *To merge the parameters into the main dataset;
proc sql; Create table Da.Da3 as select * from Da.Da2_winsor as a left join Da.Da2_parms as b on a.fyear=b.fyear and a.SIC2=b.SIC2; Quit; Data Da.Da3; Set Da.Da3; tac_pdt = intercept + wdrev*wdrev_parm + wppe*wppe_parm + wroa*wroa_parm; ADA = abs(tac-tac_pdt); Run;
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 wonder if the codes above look right.
Thanks in advance for any ideas!
07-19-2017 11:13 AM
When you compared results with 'the paper' did you have the same data or did you make something similar?
Could the differences be due to rounding such as expecting 1024.5 and you get 1024.45? If this is the case then I would suspect rounding as a contributor to the issue. This may arise if you entered displayed values from a paper that only displayed one or two decimals from the result of Proc Univariate or other procedure and but the actual data the paper used was calculated with non-displayed decimal values.
07-22-2017 12:30 AM
The mean of the the absolute discretionary accruals in the paper is 0.068, but my mean is 0.089. The sample size in the paper is 17,218, and my sample size is 103,228. My sample size is much bigger because the regression in the paper also includes other variables and loses the sample size. I wonder whether the difference of the mean is from the difference of the sample size? Does my SAS code for discretionary accruals calculation look right? Thank you!