Create a variable that is just the hour, rounded up or down according to taste. -egen- will then be able to cope.
Nick
[email protected]
Diego Bellavia
I have such a dataset:
Timestamp Pressure
11/22/09 00:00 120
11/22/09 00:01 123
11/22/09 00:02 119
11/22/09 00:03 115
11/22/09 00:09 123
11/22/09 00:10 122
11/22/09 00:22 112
etc...
As you see, Pressure values are reported by time (defined as a timestamp) every minute.
Unfortunately, the system is not so precise to collect pressure every single minute so,
I do not necessarily have 60 measures in 1 hour.
Now I would like to compute averages for Pressure every pre-spcified time range, starting, as exmaple,
with ana average of all the values collected between 00:00 and 01:00 on 11/22/2009 but also being able to
change the time range from 1 hour, to 4 or 6 hours and so on.
How can I do that in STATA, considering that I do not know how many measure are collected per hour ?
*
* 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/