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

st: help to find maximum drop in a variable


From   chris wallace <[email protected]>
To   statalist <[email protected]>
Subject   st: help to find maximum drop in a variable
Date   Tue, 2 Mar 2004 07:59:10 -0500 (EST)

My colleague has passed to me a query to which I can't find a
straightforward answer.  I am hoping some of the experts in this group
could help?

She has hourly barometric pressure data for many days.  So the dataset
contains the variables

year month day hour pressure

(with 24 hourly observations per day).  During any day the pressure may
rise and fall.  She wishes to generate a new variable containing the
maximum fall (constant within year-month-day groups).  That is, for a
fictitious series of pressure readings

90 100 90 80 70 80 65 70 90 80 70

the maximum fall is 100-70=30.  This is not simply the maximum - minimum
(100-65), since the pressure rises for one interval in that period
(70->80).

She also makes the points:
- there may be more than one drop per day... i want the largest one
- if pressure has not dropped at all through out the day, the value
returned should be zero or negative

Any suggestions?

Many thanks, Chris.


*
*   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/



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