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]

st: Elapsed Time Paneldata


From   Steven Archambault <archstevej@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Elapsed Time Paneldata
Date   Sat, 19 Jan 2013 21:38:18 -0700

Hi all,

I have gone through the help docs, but cannot figure out how to keep a
running tally of time elapsed in each panel from the beginning
observation in each panel. In my data the date does not matter so
much, but the time from the beginning of each panel does matter. In
some cases, as in the example below, the panels are observed at
different dates.

I have
newid   date
      1     06feb2012 16:59:34
      1     07feb2012 07:59:36
      1     07feb2012 16:59:11
      1     08feb2012 07:59:12
      1     08feb2012 17:00:58
      1     09feb2012 08:01:00
      1     09feb2012 17:00:35
       2    10feb2012 08:00:36
       2    10feb2012 17:00:11
       2    11feb2012 08:00:13
       2     11feb2012 16:59:48

I want to be able to generate

newid days_elapsed
1              0
1             .5
1             1
1             1.5
1             2
1             2.5
1             3
2             0
2             .5
2             1
2             1.5

Can anybody help me?

Thanks!
*
*   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