07-21-2014 10:10 PM
I got 8 million observations of bond transactions in hand, each for one transaction.
A bond may be transacted multiple times during one day, and there may be days when no transaction happened for a bond.
Now I wish to construct such a variable "ROLLINGMEDIAN" for each observation:
for each transaction at date t, calculate the median of transaction prices among all transactions of that bond happened during a 9-day window, centered at date t.
If an observation happened at the first/last 4 dates of a bond, then the variable=.