Kit mentioned panel data. For the record,
-egen, record()-, which was written by Kit
and myself, pays no attention to whether
data have been -tsset-. The handle useful
for panel data is a standard -by()- option.
As it happens, I guess that this is a nuance
not important in most projects. The record
returned will be the _known_ maximum (or
minimum) whenever any observations have missing values
or there are gaps.
A key point about missing values is that in Stata
max(large known number, missing)
is always "large known number". This may
come as a surprise once you have learned
the hard way that in Stata numeric missing
is treated as higher than any non-missing
number. But usually it is a feature. What
do you want
max(0, 1, 2.71828, 3.14159, 42, .)
to return? 42 or . ?
Nick
[email protected]
Kit Baum
> 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.
*
* 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/