Bookmark and Share

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]

Re: st: summarizing data across rows (e.g as in time use files)


From   [email protected]
To   "[email protected]" <[email protected]>
Subject   Re: st: summarizing data across rows (e.g as in time use files)
Date   Sat, 9 Mar 2013 08:36:36 +0000

-help collapse- 

collapse (sum) duration, by(person code) 

or something similar.

Sent from my iPad

On 9 Mar 2013, at 03:54, Adeel Yousaf <[email protected]> wrote:

> Hi,
> 
> I have episode file of time use showing population's activity code and
> duration. In this data, an activity longer than 30 mins (e.g. sleep)
> has multiple episodes, that creates unrealistically larger number of
> activities in one day. I want to keep one record per activity if the
> code is repeated in next row and generate combine duration for that
> activity. for example, code '11' has been repeated in three
> episodes/rows, but it should be in one row with duration=90, how can i
> do that!
> 
> person  starttime       episode duration        code
> 1       11/25/2007 4:00 1       30      11
> 1       11/25/2007 4:30 2       30      11
> 1       11/25/2007 5:00 3       30      11
> 1       11/25/2007 5:30 4       15      30
> 1       11/25/2007 5:45 5       15      60
> 1       11/25/2007 6:00 6       30      60
> 1       11/25/2007 6:30 7       30      60
> 1       11/25/2007 7:00 8       15      413
> 1       11/25/2007 7:15 9       15      412
> 1       11/25/2007 7:30 10      30      412
> 1       11/25/2007 8:00 11      15      412
> 1       11/25/2007 8:15 12      15      20
> 1       11/25/2007 8:30 13      15      413
> 1       11/25/2007 8:45 14      15      413
> 1       11/25/2007 9:00 15      30      413
> 
> 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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