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   Adeel Yousaf <[email protected]>
To   [email protected]
Subject   Re: st: summarizing data across rows (e.g as in time use files)
Date   Sun, 10 Mar 2013 11:39:17 +0800

Thanks, its good but not good enough for the purpose. after performing
as u suggested, 'starttime' variable is lost, which reflects when
activity started. If i collapse by 'starttime', it does not totals
'duration'. please share your thoughts,

On Sat, Mar 9, 2013 at 4:36 PM,  <[email protected]> wrote:
> -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/



-- 
Muhammad Adeel
Room 841 A, ,8F. Knowles building
Department of Urban Planning and Design
The University of Hong Kong
Pokfulam road, Hong Kong SAR
Cell: 0085254894670
*
*   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