Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Collpasing Data by every 4 observations


From   "Scott Merryman" <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Collpasing Data by every 4 observations
Date   Wed, 21 May 2008 14:14:00 -0500

-egen minute = fill(1 1 1 1 2 2 2 2)-
-collapse counts,by(minute)-

Scott



On Wed, May 21, 2008 at 2:03 PM, Michael W. Beets <beetsm@onid.orst.edu> wrote:
> I have 15sec interval data collected on individuals over the course of a
> single day.
>
> The data look like the following, where "counts" are the primary outcome and
> time is the "time" (fraction of 24hrs) the counts occurred.
>
> What I am attempting to do is create a mean of every 4 15sec intervals to
> reflect the average counts/min. Hence, if a person is monitored (at 15sec
> intervals) over the duration of 1hr, they would have 240 lines of data
> containing counts. This needs to be collapsed into average counts/min
> (resulting in 60 lines of data/person).
>
> However, I am unaware of how to specify the collapse command to take the
> average of every 4 lines of data.
>
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index