Dear Stata list,

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
Now, the problem is that if I want to refer to a particular date in my code like:

Code:
sum total_volume if bdate == td(01jan2020)
it doesn't work because the bdate variable is in a different format, namely %tbxetra. But when I try

Code:
sum total_volume if bdate == tbxetra(01jan2020)
I get the error message 'unknown function tbxetra()'. Of course, I could use a workaround and format the date variable to %td and use this as a reference.
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