[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Tsset question: calculating returns using daily prices - weekend issue
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.
* For searches and help try: