I would like to create a new variable where each value is the minimum value of the previous 5 values. The code below shows part of my data (5 minute close stock prices). How can this be created using egen (or gen) and min?
Code:
CLOSE Price 4377.84 4377.59 4340.01 4345.31 4354.90 4340.00 4340.00 4340.00 4345.95 4337.00 4320.07 4344.95 4320.03
0 Response to Egen command; minimum value over last 5 observations
Post a Comment