Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Measuring two time-spells


From   "Jan Sauermann" <[email protected]>
To   [email protected]
Subject   st: Measuring two time-spells
Date   Wed, 23 Jul 2008 18:15:30 +0200

Dear Statalist.

my setting is the following: I observe two workers (i and j) for about
one year. They are at the same workplace; I have information on when
they enter, and when they leave work (my time data is continuous in
seconds). I would like to have a third variable which gives me
information when they are both at the workplace. Eventually, I would
like to have an aggregate variable, e.g. for week 40 of year 2007, how
many hours they have spent together at work.

The main problem is that they have changing shifts and changing number
of hours at one day. I.e., at one day, worker i starts after worker j,
but leaves earlier; another day, i starts first and leaves first. It
can also be more complicated if i has a long shift and j jas two short
shifts during this period.

To make it graphically, I would like to measure the following distance
(I hope that works properly):

Time t ------------------------------------> T
i at work        <---------->
j at work    <------->
I want:          <--->


My data now looks like this (only a minor part):

       | worker                login               logout   spell |
       |----------------------------------------------------------|
    1. |      1   16jan2008 13:55:35   16jan2008 22:34:13       1 |
    2. |      1   20dec2007 14:26:54   20dec2007 23:00:14       2 |
    3. |      1   03may2008 07:49:56   03may2008 11:10:25       3 |

   57. |      2   02jan2008 17:00:08   02jan2008 23:06:53       1 |
   58. |      2   01dec2007 13:32:37   01dec2007 19:33:34       2 |
   59. |      2   09jan2008 17:02:59   09jan2008 23:04:12       3 |

  178. |      3   09may2008 08:00:12   09may2008 14:00:36       1 |
  179. |      3   06nov2007 14:30:45   06nov2007 19:29:57       2 |
  180. |      3   09oct2007 13:31:02   09oct2007 19:30:11       3 |

[...]


This example now is just for two persons. I think, when having a
solution for worker i and j, it can be easily extended to N workers by
looping.


I hope that it is clear what I mean. It would be really nice if
somebody could help me!!

Best regards,

Jan

--
Jan Sauermann (<[email protected]>)
Research Centre for Education and the Labour Market (ROA) / Maastricht
University

P.O. Box 616 | NL - 6200 MD Maastricht
office: +31.43.3883801 | mobile: +31.655853921
<http://www.roa.unimaas.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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index