Help using Base SAS procedures

How to construct a rolling window median in panel data?

Reply
N/A
Posts: 1

How to construct a rolling window median in panel data?

Dear all,


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=.


Thank you!

Ask a Question
Discussion stats
  • 0 replies
  • 144 views
  • 0 likes
  • 1 in conversation