Announcement

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

  • how to only keep the observation at inclusion in a dataset

    Hi,

    I m using STAT V17

    I have a dataset where observation at inclusion are mixed with follow up observation..
    I have the "date of inclusion" and "date of mesurement" for the observation
    And I only want to use the inclusion data ..

    I wonder if there is a way for an observation with the same "ident" to keep only the observation with the earliest measurement date ?

    here and exemple of the dataset:
    Click image for larger version

Name:	Sans titre.jpg
Views:	1
Size:	37.7 KB
ID:	1669452



    Thank you for your help !

    Marguerite



  • #2
    Marguerite:
    you may want to try what follows (caveat emptor: code untested due to the lack of a viable example provided by the original poster, despite the FAQ recommendations ):

    Code:
    bysort ident (Date_of_mesuremen): keep if _n==1
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for your answer, it was really helpfull,
      This solution perfectly work
      I take note for the FAQ recommendations !

      Marguerite

      Comment

      Working...
      X