Andrea Schaefer
>
> I am trying to insert a new variable into the existing data file.
> Which looks like this:
>
> t0 t1 id seqvar fam95 fam96 fam97 fam98 dur
> 34 35 1 1 1 1 1 0 1
> 0 2 2 1 1 1 0 0 3
> 0 2 2 2 1 1 0 0 3
> 0 2 2 3 1 1 0 0 3
> 56 58 3 1 0 0 0 1 3
> 56 58 3 2 0 0 0 1 3
> 56 58 3 3 0 0 0 1 3
>
> I want to generate a new variable that marks the spells
> belonging to a
> certain period, like this (year):
>
> t0 t1 id seqvar fam95 fam96 fam97 fam98
> dur year
> 34 35 1 1 1 1 1 0 1 98
> 0 2 2 1 1 1 0 0
> 3 95
> 0 2 2 2 1 1 0 0 3 95
> 0 2 2 3 1 1 0 0 3 96
> 56 58 3 1 0 0 0 1 3 99
> 56 58 3 2 0 0 0 1
> 3 00
> 56 58 3 3 0 0 0 1 3 00
>
> But the spells are often longer than than the periods.
> Has somebody a idea how to do this?
Please explicit about the rule for calculating
-year- from the other variables.
In general, spells are easier with a long
data structure and -tsset- data. -tsspell- on
SSC is one tool for this purpose.
Nick
[email protected]
*
* 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/