Dear All, Suppose I have the following data:
For each company and each year, I wish to construct three variables max1, max2, and max3, which is the (first, second, and third) maximum value of the past 8 years of `invest' variable, respectively. Any suggestions? Thanks.
PS: I think that the maximum (max1) can be obtained as follows (ssc install rangestat):
Code:
webuse grunfeld, clear
PS: I think that the maximum (max1) can be obtained as follows (ssc install rangestat):
Code:
rangestat (max) max1=invest (count) n1=invest, interval(year -8 -1) by(company)

Comment