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
ml model command for log-likelihood Nash Equilibrium modelI am attempting to run STATA code from Abbott (2009) (cited below). I am attempting to run this to a…
How to remove the thick x-axis line on a histogram?Hi, I created a histogram but there is a thick line on the x-axis. I checked using graph editor, an…
Dropping obs in a frame and expand to linked frame the selectionHi, I'm currently working on a frame linked m:1 to another. I deleted some obs from the dataset and …
Converting GPS data from Decimal Minutes Seconds to Decimal DegreesHi Statalisters, I need to convert GPS longitude and latitude data from the Decimal Minutes Second …
Calculate vertical spilloversDear Stata users I would like to construct vertical spillovers of fdi for upstream and downstream in…
Subscribe to:
Post Comments (Atom)
0 Response to how to calculate the moving average for a variable
Post a Comment