To calculate quarterly index returns from monthly index returns starting from the first month of the quarter to the third month of the quarter, I do:
Code:
gen log_monthly_factor=log(1+vwretd) by fqdate, sort: egen quarterly_vwretd=total(log_monthly_factor) replace quarterly_vwretd=(exp(quarterly_vwretd)-1)
An example of my data is here:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long DATE double vwretd float(year fqdate) 28 -.06624392 1960 0 59 .01441908 1960 0 90 -.01282217 1960 0 119 -.01527067 1960 1 151 .03409799 1960 1 181 .0228328 1960 1 210 -.02270468 1960 2 243 .03221498 1960 2 273 -.058673340000000004 1960 2 304 -.004704664 1960 3 334 .0486173 1960 3 364 .04853724 1960 3 396 .0639524 1961 4 424 .03700465 1961 4 454 .030609920000000002 1961 4 483 .005644733000000001 1961 5 516 .02589407 1961 5 546 -.02849906 1961 5 577 .02995465 1961 6 608 .026854410000000002 1961 6 637 -.01999036 1961 6 669 .027331130000000002 1961 7 699 .04545113 1961 7 728 .0007129512 1961 7 761 -.036146990000000004 1962 8 789 .01951236 1962 8 end format %td DATE format %tq fqdate
0 Response to quarterly returns
Post a Comment