I have a list of dates for specific company events of listed US companies. This variable (reguldate) may include weekends as well as holidays.
For each of these companies, I have a dataset containing daily stock price data from which I created a business calender:
I then transformed the regular event dates using:
The help file states:
However, if reguldate is a non trading date (according to the business calender I created) I would like to get previous trading date instead of a missing value, so something like: businessdate-1
Is there a way to include those values what are omited according to my .stbcal file?
Thanks
For each of these companies, I have a dataset containing daily stock price data from which I created a business calender:
Code:
bcal create biscal, from(date) replace
Code:
gen businessdate= bofd("biscal",reguldate)
Function bofd() returns missing when the date does not appear on the specified calendar.
Is there a way to include those values what are omited according to my .stbcal file?
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int regulardate float businessdate 14607 104 14570 79 14571 80 14574 82 14572 81 14577 83 14578 84 14579 85 14578 84 14579 85 14577 83 14580 86 14580 86 14580 86 14585 89 14584 88 14573 . 14584 88 14585 89 14585 89 end format %tdDD/NN/CCYY regulardate format %tbbiscal businessdate
Comment