Announcement

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

  • loops

    Dear Stata users,


    I have data with repeated measure of estimated glomerular filtration rate (eGFR). I would like to identify those who had >=20% increase in eGFR from baseline within 1st year of follow-up (at least in 2 visits). How can I do this? I would really appreciate if anyone may help.

    Data looks as below:


    PHP Code:
    [CODE]
    Example generated by -dataex-. To installssc install dataex
    clear
    input long ID double gfr float numeric_visit int days_from_baseline float t_years
    1 53.7  0    0         0
    1 80.6  4  115  .3150685
    1 68.4 12  349  .9561644
    1 46.7 24  731 2.0027397
    1 38.1 36 1101  3.016438
    1 46.4 48 1452  3.978082
    1   39 72 2187  5.991781
    1 34.1 84 2558  7.008219
    2 61.2  0    0         0
    2 76.1  4  122  .3342466
    2 90.6 12  367 1.0054795
    2 63.2 24  731 2.0027397
    2 66.7 28  850  2.328767
    2 70.3 32  962 2.6356165
    2 69.9 36 1102  3.019178
    2 68.3 40 1214 3.3260274
    2 79.4 44 1326 3.6328766
    2 67.5 48 1459   3.99726
    end
    [/CODE

    Thank you.
    Sincerely,
    Oyun



  • #2
    Could you tell us what results you would expect for the two IDs in your sample data? It is not clear to me what you mean by

    within 1st year of follow-up (at least in 2 visits)
    Must the patient have
    • a 20% increase for at least two visits, both within 1 year of baseline
    • a 20% increase for at least two visits, or within 1 year of baseline, whichever is sooner
    • a 20% increase on at least one visit of the first two visits, or within 1 year of baseline, whichever is sooner
    • something else that I haven't guessed

    Comment


    • #3
      Thank you for comment and sorry about unclear post. In my real data, eGFR was measured every four months for some participants, so I've included at least 2 visits.
      • a 20% increase for at least two visits, or within 1 year of baseline, whichever is sooner-is my option.

      Thanks again.

      Comment


      • #4
        This seems to me to do what you want, and if not, it is I hope clear enough in its logic to point you in a useful direction.
        Code:
        bysort ID (days_from_baseline): generate test = (_n==2 | _n==3) & days_from_baseline <= 365
        bysort ID (days_from_baseline): generate incr = (gfr/gfr[1]) >= 1.2
        bysort ID: egen n_test = total(test)
        bysort ID: egen n_incr = total(test & incr)
        generate success = n_incr==n_test
        replace success = 0 if n_test==0

        Comment


        • #5
          This is exactly what I was trying to create. Thank you so much for your help!

          Comment

          Working...
          X