I am using time series data with a business calendar as I only look at trading dates. The set up looks like this:
Code:
gen date = date(PERIOD_NAME, "DMY") // from string variable containing dates in the indicated format bcal create xetra, from(date) replace // create business date calendar gen bdate = bofd("xetra", date) // create business date variable using calendar and date variable format bdate %tbxetra // format business day variable tsset bdate // set business day variable
Code:
sum total_volume if bdate == td(01jan2020)
Code:
sum total_volume if bdate == tbxetra(01jan2020)
But as soon as I want to loop over the single dates of a window of two years for example I run into problems because the date varialble has gaps but I cannot refer to the bdate variable.
So my question is: Is there a way of using the standard td() or tb() function with business calendars with my tsset variable bdate?
Thanks for your help!
Paul
0 Response to Referring to dates using business calendars
Post a Comment