How can I identify the historical maximum value of a variable in time-series data?
I know the command egen MaxValue = max(Variable), but I don't know how to restrict Stata's search to historical values only (or prior values after sorting the data w.r.t. time). For example, I have data on the variable of interest from 2000 to 2010 and in 2005 I want to identify the maximum value of this variable up to the year 2005
I know the command egen MaxValue = max(Variable), but I don't know how to restrict Stata's search to historical values only (or prior values after sorting the data w.r.t. time). For example, I have data on the variable of interest from 2000 to 2010 and in 2005 I want to identify the maximum value of this variable up to the year 2005
Comment