Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Turning an observation with start and end dates into a time series


From   Malcolm Wardlaw <malcolm@mail.utexas.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Turning an observation with start and end dates into a time series
Date   Sun, 31 May 2009 15:02:09 -0500

I have a quick question about the best practice for forming a time
series from an observation with a start and end date.  I have a couple
of ways that I do it, either with -reshape- or -expand- and then using
various fills, but they seem too much like inelegant hacks.

Specifically, lets say I have a list of observations that contain:
ID   var1   var2   start   end
1     3        4       6        8
2     4        3       7        9

I want to turn it into the following:
ID   var1   var2   date
1     3        4        6
1     3        4        7
1     3        4        8
2     4        3        7
2     4        3        8
2     4        3        9

Is there a best practice way to do this?
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index