[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Changing spells to person-years
At 01:30 PM 11/20/2006, Justin wrote:
Hello trusty listservers,
This is somewhat straightforward for this one attribute. It's a
-stack- or -reshape long- matter.
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?
BUT, what happens when you combine other attributes. Do they all fit
into the same patterns of years? Or does each attribute have its own
pattern of years?
If the latter, then you may need to first treat each attribute
separately. Then put them together with a -merge-.
Another matter: Is it always true that the end of a spell is
start_of_next_spell -1 ? (No gaps, no overlaps.) If so, then you
can eliminate the end dates. (Though, you may need to insert a dummy
spell for each person to signify the end of the latest-known spell.)
And then, later, in the -merge- step, the match-key variables will be
person-id and start_year. (But in any case, you should not include
the end_dates in the merge.)
Under this scheme, the result will be that for each person, different
attributes will all share the same pattern of spells, using a "fine"
granulation of years -- where the start dates are the union of all
start dates of the spells of the different attributes. Then, some
attributes will not change at every spell transition. A spell
transition will occur when at least one attribute changes.
If you spell out the structure of your data in more detail, then we
can better help you.
* For searches and help try: