Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: How to add business days to an existing date |
Date | Tue, 8 May 2012 19:29:37 +0100 |
Make sure your Stata is fully up-to-date. -help whatsnew- signals various fixes since Stata 12 was first released that concern business calendars. If your Stata does not say what it says below, you need to -update-. (Or hassle your systems people to do that.) . update query (contacting http://www.stata.com) Update status Last check for updates: 08 May 2012 New update available: none (as of 08 May 2012) Current update level: 24 Apr 2012 (what's new) Possible actions Do nothing; all files are up to date. Nick On Tue, May 8, 2012 at 6:47 PM, Tanja Berg <tanja.berg86@gmx.de> wrote: > 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 <tanja.berg86@gmx.de> 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/