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

From |
John-Paul Ferguson <jpferg@MIT.EDU> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Converting span data to spell data |

Date |
Tue, 27 Nov 2007 23:13:54 -0500 |

Hello, I am struggling with converting panel data from one form to another. The current data structure does not seem to lend itself to a simple reshape. I am also struggling with the first wave of the winter colds and flus, which may be why the solution is eluding me. I'd greatly appreciate ideas anyone has on the following problem. Presume I have data in the following form: id start end true a 1 4 1 a 5 6 0 a 7 10 1 a 11 13 0 a 14 16 1 b 1 3 1 b 4 7 0 b 8 10 1 I would like to put it in this form: id period true a 1 1 a 2 1 a 3 1 a 4 1 a 5 0 a 6 0 a 7 1 a 8 1 a 9 1 a 10 1 a 11 0 a 12 0 a 13 0 a 14 1 a 15 1 a 16 1 b 1 1 b 2 1 b 3 1 b 4 0 b 5 0 ...and so on. This isn't quite the same as running reshape on the data, because the data are not, technically, in a wide format. I suspect I am not the first person to encounter this issue: I have data that reports spans of time when some condition holds, and I want to convert the data into spells. Is there a canned command, or a canny combination of reshape and some other commands, that will do this? Best Regards, John-Paul Ferguson MIT * * 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/

**Follow-Ups**:**st: RE: Converting span data to spell data***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: __0000004 already defined - error?***From:*Johannes Geyer <JGeyer@diw.de>

- Prev by Date:
**Re: st: Help with multiple imputation using Stata** - Next by Date:
**st: __0000004 already defined - error?** - Previous by thread:
**st: problem with xtlogit** - Next by thread:
**st: __0000004 already defined - error?** - Index(es):

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