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

From |
orozco@toulouse.inra.fr |

To |
statalist@hsphsun2.harvard.edu |

Subject |
RE:st:Measuring two time-spells |

Date |
Fri, 25 Jul 2008 08:37:54 +0200 |

Dear Jan, What about generating variables indicating, by date (extracted via the login), the maximum hour of entry (Max of login) and the minimum hour of entry (Min of logout) between workers. Then, you can easily calculate the difference of these two times, which corresponds to the intersection of two workers. Look at this example with only 2 workers: date worker login logout maxlogin minlogout inter 16-janv-08 1 16/01/2008 13:55 16/01/2008 22:34 16/01/2008 13:55 16/01/2008 22:34 8:38 16-janv-08 2 16/01/2008 07:50 16/01/2008 23:00 16/01/2008 13:55 16/01/2008 22:34 8:38 20-janv-08 1 20/01/2008 14:26 20/01/2008 15:52 20/01/2008 14:26 20/01/2008 15:52 1:25 20-janv-08 2 20/01/2008 10:05 20/01/2008 19:30 20/01/2008 14:26 20/01/2008 15:52 1:25 Hope this helps you. Valérie ------------------------------- Valérie OROZCO Toulouse School of Economics (INRA-GREMAQ) 21, allée de Brienne F-31000 Toulouse, France MF 426 +33 5 61 12 85 91 ------------------------------- ________________________________________ From "Jan Sauermann" <jan.sauermann@gmail.com> To statalist@hsphsun2.harvard.edu 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 (<j.sauermann@roa.unimaas.nl>) Research Centre for Education and the Labour Market (ROA) / Maastricht University * * 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/

**Follow-Ups**:**Re: st:Measuring two time-spells***From:*"Jan Sauermann" <jan.sauermann@gmail.com>

- Prev by Date:
**st: syntax error help is needed** - Next by Date:
**Re: st: syntax error help is needed** - Previous by thread:
**st: syntax error help is needed** - Next by thread:
**Re: st:Measuring two time-spells** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |