Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Prepare data for time-varying covariate

    Hi All,
    I am trying to set up my data for time-varying covariate survival analysis.
    two time variables are
    ppi_ppi_day :- days for ppi and pps score recorded
    Fw_day :- date of admission to the last date of follow up

    My original data set is “id to pps” and I want to set up the data “t0 to pp_2”

    Is there is way to set up the data in Stata?

    Code:
    list, sepby(id) noobs
    
     +--------------------------------------------------------------------------------+
      | id     death   fw_day   ppi_pp~y   ppi    pps   t0   tend   _d   ppi_1   pps_2 |
      |--------------------------------------------------------------------------------|
      |  1     Death        7          0     6   0.30    0      7    0       6    0.30 |
      |  1     Death        7          7   6.5   0.10    7      7    1     6.5    0.10 |
      |--------------------------------------------------------------------------------|
      |  2     Death        7          0   8.5   0.50    0      7    1     8.5    0.50 |
      |--------------------------------------------------------------------------------|
      |  3     Death        8          0   4.5   0.30    0      7    0     4.5    0.30 |
      |  3     Death        8          7    11   0.10    7      8    1      11    0.10 |
      |--------------------------------------------------------------------------------|
      |  4     Death       45          0   4.5   0.50    0      7    0     4.5    0.50 |
      |  4     Death       45          7   4.5   0.50    7     14    0     4.5    0.50 |
      |  4     Death       45         14   4.5   0.50   14     21    0     4.5    0.50 |
      |  4     Death       45         21   4.5   0.40   21     28    0     4.5    0.40 |
      |  4     Death       45         28   4.5   0.50   28     45    1     4.5    0.50 |
      |--------------------------------------------------------------------------------|
      | 17   Censord       76          0     1   0.60    0      7    0       1    0.60 |
      | 17   Censord       76          7   2.5   0.50    7     14    0     2.5    0.50 |
      | 17   Censord       76         14   2.5   0.50   14     21    0     2.5    0.50 |
      | 17   Censord       76         21     0   0.60   21     28    0       0    0.60 |
      | 17   Censord       76         28     0   0.60   28     56    0       0    0.60 |
      | 17   Censord       76         56     0   0.60   56     76    0       0    0.60 |
      +--------------------------------------------------------------------------------+

    Thanks

  • #2
    Dear Suganthiny,

    Thank you for your question, however, I find it somewhat unclear. Could you be more specific about how you want the data to be set up? I struggle to understand what you mean from the following quote from your post.

    Originally posted by suganthiny kumarasamy View Post

    My original data set is “id to pps” and I want to set up the data “t0 to pp_2”
    Best,
    Salvatore

    Comment

    Working...
    X