Dear all
I am trying to calculate the average bond maturity over the preceding three months as an instrumental variable in my analysis. it is worth noting that my data is unbalanced and one firm_id can have multiple observations within one year. Therefore, declaring the data as a panel using firm_id would not work. Therefore,
My command is :
xtset observations_num Year
gen matruity_moveavrg=(F1.maturity+maturity+L1.maturit y)/3
the generated new variable is missing and the code is incorrect.
any help is highly appreciated in proving the correct code.
Related Posts with how to calculate the moving average for a variable
Plotting non linearities in regression (as dy/dx) and interaction effects from reghdfe (multiple fixed effects)Hello everyone, First of all, thank you in advance for any answers to this post. It's very rare to …
Removing the last three digits of a four-digit numeric variableHi Statalist, I am working with a four-digit integer variable, ISCO08_1. I would like to simply dro…
Moderated mediation using GSEM from a difference-in-difference approach - calculating iniDear Statalist-ers, I hope this message finds everyone well. I am currently running some Difference…
Time-lagged variable for cross-sectional dataHi, I have a seemingly simple recoding problem, which I could not solve by reading the documentatio…
Plotting non linearities in regression and interaction effects from reghdfeHello everyone, First of all, thank you in advance for any answers to this post. It's very rare to …
Subscribe to:
Post Comments (Atom)
0 Response to how to calculate the moving average for a variable
Post a Comment