Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: new spell variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: new spell variable
Date   Wed, 19 Feb 2003 18:07:21 -0000

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/



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