Hi!
I have a dataset with prices of stocks. It is a data panel by Code (the ticker of the stock) and Date. For each Code in a Date I have a price for a stock.
I need to create a new variable with the maximum price of the last 60 days for each Code (each stock).
I am trying the command bysort Code: egen Maximo=max(Fechamento). However, I am getting only one value for each Code - the maximum value for that Code during all the time.
What I need is the maximum price for the stock in the last 60 days.
Thanks!