BookmarkSubscribeRSS Feed
TerryC
Calcite | Level 5

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;
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; 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!

2 REPLIES 2
ballardw
Super User

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.

TerryC
Calcite | Level 5

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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2587 views
  • 0 likes
  • 2 in conversation