STATA - Rebalancing Quarterly - Date Variable

Started by amazon1
This forum made possible through the generous support of SDN members, donors, and sponsors. Thank you.
Get help with your application

Use all the free resources available to you from SDN: articles, guides, expert advising, forums discussions, and school research.

amazon1

New Member
7+ Year Member
Advertisement - Members don't see this ad
Hi all,

I have about 8 years daily stock returns that I would like to transform to cumulative returns over a quarters.

I would like to create a variable "rebalancing" that is equal to the portfolio rebalancing date if the variable "date" <= to the next rebalancing date. Rebalancing happens 4 times a year from 2006 to 2014 at the following dates:
- February 15
- May 16th
- August 15th
- Nov 15th

Data look like that now:
date ret
15aug2006 .026666641
16aug2006 .043290105
17aug2006 -.020746967
18aug2006 -.008474569
21aug2006 -.002136699
22aug2006 -.008565302
23aug2006 .03671708
24aug2006 .024999974

I would like to get the following:
date rebalancing ret
9-Nov-10 15-Nov-10 -0.007201
10-Nov-10 15-Nov-10 -0.006551
11-Nov-10 15-Nov-10 -0.006594
12-Nov-10 15-Nov-10 -0.009246
15-Nov-10 15-Nov-10 -0.008615
16-Nov-10 15-Feb-11 -0.005672
17-Nov-10 15-Feb-11 0.003763
18-Nov-10 15-Feb-11 0.02104
19-Nov-10 15-Feb-11 0.008171

Thanks a lot for your help in advance!