Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: simple calculations across rows

From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: simple calculations across rows
Date   Mon, 16 Jul 2012 16:56:35 +0200

On Mon, Jul 16, 2012 at 4:37 PM, B. Timothy Walsh wrote:
> I am importing data from a device and would like to use STATA to do some
> data reduction. The device monitors types of physical activity over 2 days,
> and the data are provided in rows, each of which contains a summary of data
> over pre-defined 4 hour blocks, like 8 AM to 12N. So, each subject has 6
> rows of data/day and a total of 12 rows for 2 days.
> What I wish to do is to be able to summarize--like simple averages,
> etc.--across some but not all time periods, and, maybe, days. For example,
> for each subject, calculate the total activity over the 8AM to 4PM blocks on
> day 1 and compare that to the same measure on day 2. Etc.

The combination of -by- and -egen- could be useful for such problems,
in combination with some -if- conditions to ensure you are using the
appropriate 8AM to 4PM blocks. Another possibility would be -tabstat-
with a similar -if- condition.

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index