Statalist The Stata Listserver

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

st: generate max of past values

From   Thomas <>
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,
bysort id (yr): egen x1 = max(l(0/3).x), which produces an error.

Any idea on how to do this correctly?

Many thanks,


* For searches and help try:

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