Hello, I am trying to figure out how to select participants who have a BMI>=30 for at least 1 year from clinic visit data. I've created a count variable to indicate streaks of consecutive visits with BMI>=30. I want to write code that will create start and end dates for each streak, some participants have more than one unique streak if their BMI hovers around 30. In my example data below, IDs 2 and 3 would meet the criteria and ID 1 would be excluded for not having at least 1 year. IDs 1 and 2 are straight forward- just pull the first and last dates and check if these are >1 year apart. However, I can't figure out how to handle ID 3. They have two unique streaks, but only the second streak meets the requirement of >=1 year. How do I indicate that I want each streak within each ID to have unique start and stop dates? ID BMI_date BMI BMI_Count 1 1/2/2020 36 1 1 4/3/2020 38 2 1 5/6/2020 36 3 1 11/18/2020 36 4 2 6/5/2020 30 1 2 12/17/2020 32 2 2 9/15/2021 33 3 3 7/19/2020 35 1 3 9/1/2020 34 2 3 10/4/2020 32 3 3 12/20/2020 29 0 3 6/4/2021 30 1 3 1/4/2022 30 2 3 9/14/2022 31 3 Thank you for reading! I'm using SAS 9.4. This is my first post on here, please let me know if I need to include more information.
... View more