I will illustrate my question with an example.

Say I have a variable called Temperature for 100 years in a country X.

I would like to create a variable Temperature_Record such that for year n Temperature_Record=max(Temperature(year 1:year n))

That is I want it to record the maximum temperature reached as of year n. This will give me a variable that will only increase over time naturally.

In addition I would like to do that in a panel of countries if possible.

Thoughts very much appreciated. I am new to STATA.

Thank you