Hi there,
I am trying to estimate the discretionary accruals of the modified Jones model in Stata. However, I keep getting the error r(111) which says: variable term not found. I think something might be wrong with my variable fyear. These are the properties of the variable fyear: Type-double and Format-%ty.
This is the code I am running for to estimate the discretionary accruals:
gen Jones_2005_TAC2=.
forval y = 2014(1)2019{
forval i = 1(1) 22426{
display `i'
display `y'
reg TACC_2 term1 term 2 term3 if `i'==Industry_code & `y'==fyear, noconstant
predict r if `i'==Industry_code & `y'==fyear, resid
replace Jones_2005_TAC2=r if `i'==Industry_code & `y'==fyear
drop r
}
}
This is what Stata says when I run it:
. gen Jones_2005_TAC2=.
(22,458 missing values generated)
. forval y = 2014(1)2019{
2. forval i = 1(1) 22426{
3. display `i'
4. display `y'
5. reg TACC_2 term1 term 2 term3 if `i'==Industry
> _code & `y'==fyear, noconstant
6. predict r if `i'==Industry_code & `y'==fyear,
> resid
7. replace Jones_2005_TAC2=r if `i'==Industry_cod
> e & `y'==fyear
8. drop r
9. }
10. }
1
2014
variable term not found
r(111);
Hope someone can help me out. It is for my thesis!
Kind regards,
Sarah
Related Posts with Estimating discretionary accruals using modified jones model by company and year (r111 error)
Using loop for generate and replaceHi, I would like to make a loop were I create 20 new variables (stretching 2001-2020) using two cons…
Help with text on a graph aligning when there are negative numbers eg [-1.23] lining up with [1.23]Hi all, I'm hoping the tag line explains the issue! I'm plotting on a graph (like a forestplot) a co…
How to chanche variable date from "2022-6-7 00:00:00" to "2022-6-7"?How to chanche variable date from "2022-6-7 00:00:00" to "2022-6-7"? …
Seek Help to Count the Number of the Persons Who Have Different Type Gap in a Longitudinal Dataset and Correct it with Stata.I have a longitudinal dataset below, which is about students' grade retention in K-12 education syst…
Changing three-language value labels of a variable into one-language value labelsI imported survey data into STATA from RedCap software. Three languages were used while administerin…
Subscribe to:
Post Comments (Atom)
0 Response to Estimating discretionary accruals using modified jones model by company and year (r111 error)
Post a Comment