Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: simple calculations across rows
From
"B. Timothy Walsh" <[email protected]>
To
[email protected]
Subject
st: simple calculations across rows
Date
Mon, 16 Jul 2012 10:37:15 -0400
Hello!
I am a beginner-to-intermediate level STATA user, and would like to find a
solution to what I hope is a relatively straightforward problem. I have
looked a bit at the archives, and have been led in the direction of mata,
but am wondering if another (less daunting?) method might be available.
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.
Here is a somewhat simplified outline of how one subject's data might look
for the first 3 periods of day 1:
ID DAY PERIOD MEASURE
i 1 1 Xi11
i 1 2 Xi12
i 1 3 Xi13
I have only a modest dataset, so I do not need particularly efficient code.
Better code that is easy to interpret and be modified by a novice such as
myself.
Thank you for any guidance!
Tim Walsh
*
* 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/