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
filling in missing values:how to realize the logic?Take the example from the picture below, if missing values exist in stress(observation 1), then chec…
filling in missing observations?Here is part of my dataset, the same id means the same person, how to fill in missing values in name…
gaps in panelI have panel data of two year survey as the example below: * Example generated by -dataex-. To inst…
svy, subpop, missing values1) Can someone point me to a resource that explains why the linearized S.E. and the logit transforme…
Haghish's weaver command and wkhtmltopdfDear Stata users, My question is about -weaver- command written by haghish. The problem is that it …
Subscribe to:
Post Comments (Atom)
0 Response to how to calculate the moving average for a variable
Post a Comment