Dear all
I'm a new Stata user and I would need your help with the following. My dataset is as follow. I am trying to calculate BH_returns of an ID i at time t as:
BH_returns(i,t)= returns(i,1)* returns(i,2)*...*(returns(i,t)
Can you please suggest a code that can handle that? thank you
ID time returns BH_returns
aa 1 0.1 0.1
aa 2 0.14 0.14*0.1
aa 3 0.15 0.14*0.1*0.15
aa 4 0.02 0.14*0.1*0.15*0.02
bb 1 0.06 0.06
bb 2 0.2 0.06*0.2
bb 3 0.5 0.06*0.2*0.5
bb 4 0.4 0.06*0.2*0.5*0.4
I'm a new Stata user and I would need your help with the following. My dataset is as follow. I am trying to calculate BH_returns of an ID i at time t as:
BH_returns(i,t)= returns(i,1)* returns(i,2)*...*(returns(i,t)
Can you please suggest a code that can handle that? thank you
ID time returns BH_returns
aa 1 0.1 0.1
aa 2 0.14 0.14*0.1
aa 3 0.15 0.14*0.1*0.15
aa 4 0.02 0.14*0.1*0.15*0.02
bb 1 0.06 0.06
bb 2 0.2 0.06*0.2
bb 3 0.5 0.06*0.2*0.5
bb 4 0.4 0.06*0.2*0.5*0.4
Comment