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!
Related Posts with How to refers the last n rows or obs in Stata
Model selectionHi, A reviewer asked me to explain why I selected Log-Linear Model for the panel data in my submitt…
break lines in string variables used for labeling mapsHi, I'm trying to use a string label to label a map generated using the grmap command. That is, whe…
60 month rolling averageHello Community, I have a paneldataset with 913 companies and monthly return data (log returns) and…
Rolling Firm Specific Regression DailyDear Stata community: I am interested in obtaining the adjusted R2, beta and the number of observati…
How to avoid changing directory every time?I am using two devices, every time that I want to open the do file that I developed on the other dev…
Subscribe to:
Post Comments (Atom)
0 Response to How to refers the last n rows or obs in Stata
Post a Comment