Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
re:st: Finding Maximum of a series
From
Christopher Baum <[email protected]>
To
"[email protected]" <[email protected]>
Subject
re:st: Finding Maximum of a series
Date
Sat, 19 Nov 2011 10:03:25 -0500
<>
I have a time series dataset ranging from 1940 to 2000. I have to find the
maximum value in series(wage) in the following way:
Maximum wage in 1940 to 1941
Maximum wage in 1940 to 1942
Maximum wage in 1940 to 1943
Maximum wage in 1940 to 1944
and so on till
Maximum wage in 1940 to 2000
Although there are several elementary ways to do this, a useful tool is part of Nick Cox's -egenmore- package on SSC, which contains the egen record() function. That allows you to compute, for instance, the 'record', or largest value to date, for the time series (In this case the 'record' value is the highest, as in most points scored per World Cup final game, rather than the smallest, e.g., fastest Olympic marathon; record() can do either). By just pulling out values of the new variable for end 1941, end 1942, etc. you have what you refer to above.
webuse wpi1,clear
egen highest_price = record(wpi)
Kit
Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/