Hi all,
I have created a business calendar with an existing date variable in my dataset in Stata/SE 13.1:
bcal create calendar, from (date) generate(bcal_date)
bcal describe calendar
**stata output from describe command **
bcal describe calendar
Business calendar calendar (format %tbcalendar):
purpose:
range: 03jun2014 01jun2015
19877 20240 in %td units
0 249 in %tbcalendar units
center: 03jun2014
19877 in %td units
0 in %tbcalendar units
omitted: 114 days
114.4 approx. days/year
included: 250 days
250.9 approx. days/year
**********
When I try to count the days passed between date A and date B, I do not see the weekends being taken out in the count:
gen dayspassed = dateofdata-date
*********************
Possible issue: I believe that I would need both date vars to be using a business calendar, but I can only create a business calendar once (which was created with the "date" var). I would need the "dateofdata" var (the other date var I need) to be using also only business days.
I have read the manuals, too.
I also tried this:
gen b_calendar=bofd("calendar",date)
format b_calendar %tbcalendar:DD_NN_CCYY
--> From which I get the 1960 stata default year. I cannot format this calendar var into %td (it does not do the transformation).
How can I get the accurate number of days only counting business days? i.e, gen dayspassed = dateofdata-date?
Thank you a tons everyone.
Best.
I have created a business calendar with an existing date variable in my dataset in Stata/SE 13.1:
bcal create calendar, from (date) generate(bcal_date)
bcal describe calendar
**stata output from describe command **
bcal describe calendar
Business calendar calendar (format %tbcalendar):
purpose:
range: 03jun2014 01jun2015
19877 20240 in %td units
0 249 in %tbcalendar units
center: 03jun2014
19877 in %td units
0 in %tbcalendar units
omitted: 114 days
114.4 approx. days/year
included: 250 days
250.9 approx. days/year
**********
When I try to count the days passed between date A and date B, I do not see the weekends being taken out in the count:
gen dayspassed = dateofdata-date
*********************
Possible issue: I believe that I would need both date vars to be using a business calendar, but I can only create a business calendar once (which was created with the "date" var). I would need the "dateofdata" var (the other date var I need) to be using also only business days.
I have read the manuals, too.
I also tried this:
gen b_calendar=bofd("calendar",date)
format b_calendar %tbcalendar:DD_NN_CCYY
--> From which I get the 1960 stata default year. I cannot format this calendar var into %td (it does not do the transformation).
How can I get the accurate number of days only counting business days? i.e, gen dayspassed = dateofdata-date?
Thank you a tons everyone.
Best.
Comment