We are at cross-purposes here. I don't
know what you mean by "treatment". There
is no reference to treatment in the problem.
I believe that I have solved this problem
with code that will work. Very likely Alex
Ogan's solution is equivalent, although
-drop- is a rather extreme interpretation
of "excluding observations".
You should show that my solution is wrong,
if you think it is.
Or you could suggest another one, if
you can think of one that is better or
interesting from another point of view.
Nick
n.j.cox@durham.ac.uk
J.Fischer@lse.ac.uk
> I meant the accumulated time after visit with treatment.
> He does not have that yet. The he will also have obs with
> dov == 1 and
> 90 days after treatment
Nick Cox
> No. He already has that. You must use
> the data on transfusions.
J.Fischer@lse.ac.uk
> > It looks like to me he has to construct a time variable that
> > accumulates the number of days since last visit
Nick Cox
> > A visit results in a transfusion whenever t is 1.
> >
> > gen ttime = dov if t == 1
> >
> > This results in missings whenever t is 0.
> > Hence we fill in missings following the usual cascade principle
> > documented at http://www.stata.com/support/faqs/data/missing.html
> >
> > bysort id (dov): replace ttime = ttime[_n-1] if mi(ttime)
> >
> > Here I am assuming that you want each patient treated separately.
> >
> > Then the time since the last transfusion is simply
> >
> > gen sincettime = dov - ttime
> >
> > Then you can exclude whatever you want. You have to work
> out what to
> > do with observations before the first transfusion (on record).
> >
> > -etime- is superfluous here.
> >
> > Nick
> > n.j.cox@durham.ac.uk
> >
> > Raphael Fraser
> >
> > > I would like to exclude from my data set all observations
> up to 90
> > > days AFTER a transfusion (i.e. t = 1). The variable etime
> > is the time
> >
> > > elapse since last visit. Can any one help?
> > >
> > > id dov t etime
> > > 57 26apr1977 0 57
> > > 57 27apr1977 0 1
> > > 57 28jun1977 0 62
> > > 57 27jul1977 0 29
> > > 57 19aug1977 1 23
> > > 57 12sep1977 0 24
*
* 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/