I am trying to get quarterly returns for securities. So I am using the CRSP monthly stock file, to run the following code:
The dates are month wise so essentially quarterlyRET should be multiply the current month return with the one prior and the one even before that, thus compounding 3 months of returns.
But I get the error
I have already installed the -egenmore- package, and I thought I could potentially run this.
Is there a way to do this?
Code:
generate Ri=RET+1 bys PERMNO date: egen quarterlyRET= Ri[_n]*Ri[_n-1]*Ri[_n-2]
But I get the error
unknown egen function Ri[_n]*Ri[_n-1]*Ri[_n-2]()
Is there a way to do this?
Comment