Statalist


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

st: Generating time-varying covariates in a multiple spell data


From   "Pyy-Martikainen Marjo" <Marjo.Pyy-Martikainen@stat.fi>
To   statalist@hsphsun2.harvard.edu
Subject   st: Generating time-varying covariates in a multiple spell data
Date   8 Apr 2008 17:44:00 +0300

Hi all,

I have a data containing multiple spells per person. The spells are measured in
months.
The data is in the following form:

PERSON    BEGIN   END     EVENT     DUR
1              (  0            1 ]        1              1
1              (  4          13 ]        1               9
2              (15          25 ]        0              10

where variables BEGIN and END are measured in calendar time (1 refers to Jan
1995,
2 to Feb 1995 and so on until 60, Dec 1999).

I stset the data in the following way:

stset end, failure(event) time0(begin) exit(time .) origin(time begin)

which means I want to "set the clock to zero" at the start of each spell.
Now I would like to include a dummy for December months 12, 24, 36 and 48.
It is thus a time-varying variable getting value 1 for the December months and
0 for other months. A spell may include zero, one or many December months.
I suppose I should use stsplit and do some kind of episode splitting, but could
someone
help me and give me advice how I should do it with my data?

Thank you in advance.

Marjo Pyy-Martikainen




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