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
Choosing between xtpoisson and xtreg for a non-poisson variableDear Forum, I have a panel dataset of US imports from 130 exporters over 48 years. I am running two…
bloated estimates and CIs in regression of relative survivalhi all I am using Paul Lambert's stpm2 to regress relative survival on a set of covariates. Before r…
Perron-Vogelsang unit root test for endogenous breaksHello everyone, does anyone know if the unit root test of Perron-Vogelsang exists in stata? …
Sequential logit model with a categorical variable of interestDear all, I have intended to use seqlogit for modelling educational attainment at three different l…
Using foreach on for a subset of the dataHello, I am trying to replace missing values of ptfidelity_9_ - ptfidelity_11_ below with 0 Code: f…
Subscribe to:
Post Comments (Atom)
0 Response to how to calculate the moving average for a variable
Post a Comment