Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Carry forward an observation within a time frame
From
"Benigno Rodriguez, MD" <[email protected]>
To
[email protected]
Subject
st: Carry forward an observation within a time frame
Date
Wed, 9 Oct 2013 10:45:00 -0400
Dear David:
Thank you for this detailed response. But my problem is that I need
to carry forward to a given row with a missing CD4 the closest in
time CD4 value, as long as it is within the previous 4 months (the
last 120 days is enough precision for my purposes).
Correct me if I'm thinking about this wrong, but with your approach,
a value could be propagated down even if the "seed" for that value
occurred more than 4 months earlier. I have added a few rows
(artificially) to illustrate. Look at row 10. It occurs within 4
month of row[_n-1], but I don't want it filled out with that value,
because the last time we actually had a non-missing value was in row
3, which is more than 4 months prior to row 10.
The approach I was trying was to try to define a "spell" as one that
begins with a missing CD4 AND for which the row above has a
non-missing value (easily done). But implementing the solution from
there has proven challenging.
patid date CD4 desired
1. 1007 5-May-55 . .
2. 1007 1-Jan-00 . .
3. 1007 3-Apr-02 5 5
4. 1007 8-Apr-02 . 5
5. 1007 11-Apr-02 . 5
6. 1007 13-May-02 . 5
7. 1007 30-May-02 . 5
8. 1007 30 Jun-02 . 5
9. 1007 30-Jul-02 . 5
10. 1007 30-Aug-02 . .
BENIGNO RODRIGUEZ G., MD, MSc, FIDSA
Associate Professor of Medicine
Division of Infectious Diseases and HIV Medicine
Case Western Reserve University
Ph: +1-216-844-2057
Fax: +1-216-8445523
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/