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   Rebecca Pope <[email protected]>
To   [email protected]
Subject   Re: st: summarizing data across rows (e.g as in time use files)
Date   Sat, 9 Mar 2013 22:17:50 -0600

If you want when the activity started, just add

(min) starttime

to the code that Nick already gave you.

It isn't clear to me why you would want to keep the start time though
if you are calculating duration for the whole activity since people
could start & stop, then restart some time later. Perhaps you should
also check out -tsspell- (by Nick Cox, available from SSC), which will
divide your activities up into continuous blocks. Eg. if a person
sleeps for 30 minutes in the afternoon and then goes to bed again in
the evening and sleeps 6 hours, that would be treated as two different
episodes & you could have the "starttime" for each.

Regards,
Rebecca

On Sat, Mar 9, 2013 at 9:39 PM, Adeel Yousaf <[email protected]> wrote:
> 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/
*
*   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