# st: Is there a statacommand for a Historical Maximum? & How to cumulate series?

 From Bob Rijkers To statalist@hsphsun2.harvard.edu Subject st: Is there a statacommand for a Historical Maximum? & How to cumulate series? Date Mon, 26 Sep 2005 11:31:56 +0100 (BST)

```To Whom It May Concern,

Is there a command in stata that gives the historical maximum of a series? (Not the absolute maximum!; i.e. the historical maximum at time T is the maximum of the observations from time  t=0 up until t=T. Similarly, the historical maximum at time t=T+1 is the maximum of all the observations from time t=0 up until t=T=1, and so on; the historical maximum thus changes over time, whereas the absolute maximum can only take one value.

My second question is more straightforward; is there a command to cumulate series in Stata (i.e. to calculate the sum of price increases over time)?

Sincerely,

Bob Rijkers

P.S. I am trying to write a do-file to run the Gately price-decomposition in Stata.  This decomposition decomposes a price-series into a) an initial condition, P1, b) the cumulative series of price decreases, Pdecr, c) the cumulative series of price-increases that have led to an increase in the historical maximum, Pmax d) the cumulative series of price-increases that do not lead to an increase in the historical maximum, Pincr:

Pt=P1+Pdecr+Pincr+Pmax
*
*   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/
```