Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: generate max of past values


From   Thomas <[email protected]>
To   [email protected]
Subject   st: generate max of past values
Date   Tue, 27 Jun 2006 12:18:22 +0100

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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index