Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: simple calculations across rows


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
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

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index