Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Tsset question: calculating returns using daily prices - weekend issue


From   "Daniel Hoechle" <[email protected]>
To   [email protected]
Subject   st: Tsset question: calculating returns using daily prices - weekend issue
Date   Tue, 8 May 2007 09:24:05 +0200

Nuno,

What you could do is to produce an alternative date variable which
contains the "elapsed work days". Given that your original date
variable (in Stata's date format) is called "date", then you can
generate the respective variable as follows:

gen wdate = floor((date-1)/7)*5+dow(date)

Unfortunately, however, I have no idea on how to label this variable
such that it shows the date in a %d format...

But now you can -tsset- your dataset with

tsset id wdate

and compute the returns by aid of the lag-operator. However, note that
variable wdate does not know any holidays and non-trading days.
Therefore, whenever there is a non-trading day on a weekday, there
will be a missing return for this specific return.

I hope this helps.

Best,
Daniel
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index