Statalist


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

st: add up the total stay


From   STATA Dndee <statadndee@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: add up the total stay
Date   Thu, 11 Oct 2007 20:33:06 +0100 (BST)

Dear all 
I have a database form visitors stayed in one or more
departments during each visit.  I want to calculate
total length of stay during each visit. I need to
calculate something like those I calculated manually
under columns “Date came-Date went” and “total stay
each visit”. If Date came= Date went, then the stay
would be 0.5 and not zero.
Your help is really appreciated.
All the bests

ID DateCame DateWent DateCame-DateWent
TotalStayEachVisit
SD101 05-Nov-05 05-Nov-05 0.5 _
SD101 05-Nov-05 11-Nov-05 6 6.5
SD101 28-Apr-05 28-Apr-05 0.5 0.5
SD105 03-Jul-06 03-Jul-06 0.5 0.5
SD105 29-Mar-06 29-Mar-06 0.5 0.1
SD105 13-Jan-06 14-Jan-06 1 _
SD105 10-Jan-06 13-Jan-06 3 4
SD105 24-May-04 25-May-04 1 1
SD217 22-Sep-05 22-Sep-05 0.5 0.5




      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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