Hi everyone,
I want to calculate cumulative returns for small (past 4 weeks) intermediate (past 5-52 weeks) and long horizon (past 53-156 weeks) and want to use all three as separate variables in my analysis for a set of huge panel data set. I know how to calculate simple cumulative returns but this thing is complicated for me as i have never done this before. I think this will be some code on rolling basis.
I use the data from CRSP. the id variable is "permno" time variable is "date2" and i have returns of each week titled "ret" and price defined by "prc". I have attached the image of sample file for ease.
This is how i calculated cumulative returns. xtset permno date2 by permno (date2), sort: gen cum_ret = sum(ret)
Thanks in advance.
I want to calculate cumulative returns for small (past 4 weeks) intermediate (past 5-52 weeks) and long horizon (past 53-156 weeks) and want to use all three as separate variables in my analysis for a set of huge panel data set. I know how to calculate simple cumulative returns but this thing is complicated for me as i have never done this before. I think this will be some code on rolling basis.
I use the data from CRSP. the id variable is "permno" time variable is "date2" and i have returns of each week titled "ret" and price defined by "prc". I have attached the image of sample file for ease.
This is how i calculated cumulative returns. xtset permno date2 by permno (date2), sort: gen cum_ret = sum(ret)
Thanks in advance.
Comment