Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: historical maximum

From   Kit Baum <>
Subject   st: historical maximum
Date   Mon, 26 Sep 2005 21:50:55 -0400

Michael suggested

You can get the running/cumulative maximum using subscripting, such as

gen cummax=x in 1
replace cummax=max(x,cummax[_n-1]) in 2/l

If you have panel data or missing data/gaps, you may want to check out using
time series operators by using tsset.

The egen function record (think of setting a record...) handles the nitty-gritty details quite nicely. It is available in the egenmore package from ssc. It will deal with panel data and missing values.

Kit Baum, Boston College Economics

* For searches and help try:

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