Statalist


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

st: Data management question for survival analysis problem


From   MAY BAYDOUN <[email protected]>
To   [email protected]
Subject   st: Data management question for survival analysis problem
Date   Mon, 13 Apr 2009 12:58:55 -0700 (PDT)

Dear Statalisters,

I am trying to do the following so I can run survival analysis using a person-period file. I have data with id and visits and each visit is related to a particular which is the time variable. I have a variable that changes over visits and has a cutpoint at 16. I changed this variable from continuous to binary (<=16:0 and >16: 1). Now, I want to create a time-dependent variable, in such a way that if someone is zero for all visits, he/she is zero. If they become "1" at a visit, they are 1 in subsequent visits unless they score another "1" in which case, they become a "2". I don't want to have missing values for this new variable. What is the easiest way to do this? Below is an example:

ID  VI     AGE    CONTVAR    BINVAR  TDVAR
1   1      60      .         .       .  
1   2      62      .         .       .
1   3      66      12        0       0
1   4      67      14        0       0 
1   5      72      17        1       1

2   1      etc.    20        1       1
2   2              .         .       1
2   3              12        0       1

3   1              22        1       1    
3   2              12        0       1   
3   3              16        0       1
3   4              18        1       2
3   5              19        1       3  

4   1              22        1       1 
4   2              24        1       2   
4   3              25        1       3

Thanks for any help you can provide. 

Sincerely yours,

May







May Baydoun, PhD in Epidemiology (UNC-Chapel Hill)  Staff Scientist,  National Institute on Aging, NIH/IRP,  Biomedical Research Center,  Baltimore, MD


      
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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