Statalist The Stata Listserver


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

st: Changing spells to person-years


From   "Buszin, Justin" <Justin_Buszin@brown.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Changing spells to person-years
Date   Mon, 20 Nov 2006 13:30:24 -0500

Hello trusty listservers,

 

I have spell that that I want to convert into a long file. Using a life history calendar, I have below four people who show changing residences (rural/urban) across their life course. Each row represents one person. For instance, person 1 lived in a rural area from 0-3, an urban area from 4-6, rural from 7-15, and urban 16-20. That person at the time of the survey was 20 years old. Person 3 lived in a rural area her whole life. 

 

cw2i1   cw2i1s cw2i1e cw2i2  cw2i2s cw2i2e cw2i3  cw2i3s cw2i3e cw2i4  cw2i4s cw2i4e 

rural          0         3      urban         4         6      rural        7         15    urban      16        20

urban        0        30      rural        31       32       .              .          .           .            .         .

rural         0         38        .              .          .         .              .           .         .           .          .

urban        0        17      rural       18        54      urban      55        57       .            .          .

 
While I have shown how it looks for residence location, the same exists for education and other variables. I know I could generate hundreds and hundreds of new variables so that each cell in the calendar represents a variable in STATA, but from reading the listserv, it seems that there is an easier way, although it is not clear to me. How can I turn this into a person-year file?
 
Thanks,
Justin

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