Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Time to maturity


From   Ferdinand Siagian <fsiagian@maine.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Time to maturity
Date   Wed, 19 Oct 2011 12:10:46 -0400

Thanks Steve and Nick.

This is how I did it and it works.

tostring transdate, replace;
generate tradedate=date(transdate, "YMD");

tostring matdate, replace;
generate expdate=date(matdate, "YMD");

generate t = (expdate - tradedate);

Best,
Ferdinand

On 10/18/11 5:31 PM, Steve Nakoneshny wrote:
I appreciate the correction, Nick. Thanks.

On 2011-10-18, at 2:21 PM, Nick Cox wrote:

Good advice, but for one detail. The difference between two daily
dates is not itself a daily date, so the difference should not be
assigned a %td format.

On Tue, Oct 18, 2011 at 8:05 PM, Ferdinand Siagian<fsiagian@maine.edu>  wrote:

Thanks Steve.

On 10/18/11 2:52 PM, Steve Nakoneshny wrote:
I would convert the date variables into Stata date format first, see -help
date- for how to do this.
 From there, -gen newdate= (maturity date - transaction date)- and
-format newdate %td- should get you there.
On 2011-10-18, at 12:46 PM, Ferdinand Siagian wrote:

I have a data set with transaction dates and maturity dates in YYYYMMDD
format. The data Type is long and the format is %12.0g. I have been
trying to calculate the number of days from the transaction date to the
maturity date (or time to maturity) but could not find the best way to
do it. Example:

Transaction date        Maturity date
20090120                20100520
20100315                20110825
*
*   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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index