[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Gap in treatment

To   "" <>
Subject   st: RE: Gap in treatment
Date   Sat, 11 Jul 2009 22:11:55 +0000

Make sure your date has the proper format (i.e %td), then:

sort patient date
by patient: gen gap=date[_n]-date[_n-1]
by patient: egen maxgap=max(gap)

Hope this helps,
Jorge Eduardo Pérez Pérez

-----Original Message-----
From: [] On Behalf Of Gary Walker
Sent: sábado, 11 de julio de 2009 04:45 p.m.
Subject: st: Gap in treatment

I have a dataset of each administration of chemotherapy for a number
of patients, i.e.:

Patient     date      chemo drug
A          7/1/2009    X
A         4/1/2009    Y
A          1/1/2008    X
B          7/1/2009    Z
B          1/1/2008    X
C          7/1/2009    Y
C          4/1/2009    X
C          1/1/2008    Z

I want to calculate the biggest gap in treatment for each patient. In
other words, what was the maximum amount of time between treatments
for each patients.  Any ideas on how to do this?
*   For searches and help try:

*   For searches and help try:

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