Hello everybody, I was hoping somebody could help me with my following problem:
I have an unbalanced panel dataset consisting of firms (secid) and daily dates (date). For each secid and date there is a variable (iv) that corresponds to the implied volatility of an option for each firm at each date. I want to create a moving percentile rank that describes each iv with regards to its historical values for the last year. That is, for each secid, its daily iv should be ranked as a percentile from a look back period of 252 days. All firms have more than 252 days of data but they dont all have the same dates or number of observations. I tried the following command but the result was an ongoing command that did not end after several hours, so had to stop it:
tsset secid date
bysort secid (date):
rolling i, window(252) clear:
egen i = rank(iv), track
gen pcrank = (i-1) / (252-1)
Appreciate any feedback, thank you very much.
I have an unbalanced panel dataset consisting of firms (secid) and daily dates (date). For each secid and date there is a variable (iv) that corresponds to the implied volatility of an option for each firm at each date. I want to create a moving percentile rank that describes each iv with regards to its historical values for the last year. That is, for each secid, its daily iv should be ranked as a percentile from a look back period of 252 days. All firms have more than 252 days of data but they dont all have the same dates or number of observations. I tried the following command but the result was an ongoing command that did not end after several hours, so had to stop it:
tsset secid date
bysort secid (date):
rolling i, window(252) clear:
egen i = rank(iv), track
gen pcrank = (i-1) / (252-1)
Appreciate any feedback, thank you very much.
Comment