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
Generating cluster averageHi I would like to create a variable that measures the cluster average of women’s working status. I …
ado programming option helpHello Forum, I have successfully written a ado-command, unfortunately I have problem with one littl…
Appending AssistanceHello, I'm trying to append all the files in a folder together, and have the following code: clear …
Trend test in StataHello, I have been using Stata to analyse all of my data, however my supervisor has asked me to per…
new version smclpres available on SSCThanks to Kit Baum a new version of smclpres is now available from SSC. To install type in Stata ssc…
Subscribe to:
Post Comments (Atom)
0 Response to how to calculate the moving average for a variable
Post a Comment