[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: generate max of past values
Dear all,
I am trying to get the maximum of all past or present values, i.e.
x[i] = max x[j, j<=i]
I tried the following commands:
bysort id (yr): egen x1 = max(l0.x&l1.x&l3.x), which returns 1 instead
of the max,
and
bysort id (yr): egen x1 = max(l(0/3).x), which produces an error.
Any idea on how to do this correctly?
Many thanks,
Thomas
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/