Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to add business days to an existing date


From   Tanja Berg <[email protected]>
To   [email protected]
Subject   Re: st: How to add business days to an existing date
Date   Tue, 8 May 2012 19:47:20 +0200

My business calendar looks like follows

version 12
purpose "Test"
dateformat dmy

range 01jan2005 31dec2011
centerdate 01jan1960

from 03jan2005 to 30dec2011: omit dayofweek (Sa Su)
from 03jan2005 to 30dec2011: omit date 01jan*
from 03jan2005 to 30dec2011: omit date 01may*
from 03jan2005 to 30dec2011: omit date 15aug*
from 03jan2005 to 30dec2011: omit date 03oct*
from 03jan2005 to 30dec2011: omit date 25dec*
from 03jan2005 to 30dec2011: omit date 26dec*

Then I load the calender in Stata with the command: bcal load test
Then I want to format my existing date into the business date format, that I can add 3 business days.
I do this with the command: format Date %tbtest
If I then want to check what happened in the Data Browser I see that the Date is now formatted as a number and if I want to close the Data Browser, Stata shuts down and says: Stata/SE 12.0 was shut down unexpected"

Thanks!



Am 08.05.2012 um 19:29 schrieb Nick Cox:

> I think we have little scope for diagnosing precisely what you are
> doing wrong here. You can either go to Stata tech-support, or come
> back to the list, with _precise_ details of what you are doing to
> define a business calendar, in what sense Stata "crashes", etc.
> 
> Nick
> 
> On Tue, May 8, 2012 at 6:24 PM, Tanja Berg <[email protected]> wrote:
> 
>> I have a data set with time series observations in the following format
>> 
>> ID      Date            Price
>> 1       01.01.2005      X
>> 1       02.01.2005      X
>> 1       03.01.2005      X
>> .......
>> 2       01.01.2005      X
>> 2       02.01.2005      X
>> 2       03.01.2005      X
>> .......
>> 
>> Now I need to calculate a "Value Date", which means that I need a new Date which is the stated Date plus three Business Days. So weekends and bank holidays like January 1st, December 25th etc.
>> should be omitted.
>> How can I solve this problem?
>> I already tried to solve this with a business calendar, but Stata always crashed if I load my calender. By the way, I am not 100% sure if I am doing everything in the correct way with the business calender.
>> Is there a way without using the business calendar??
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index