I read this post here which deals with a similar issue but I unfortunately don't understand how to apply it to my situation: https://communities.sas.com/t5/Base-SAS-Programming/Comparing-a-row-in-a-dataset-with-the-next-row/td-p/184735 What I am trying to do is for each patient when the col1 goes from a 1 to a 0, then drop all following observations for that patient. What I am trying to do is create a start and end date for each studyid based on the 1st time any of the anemia variables are 1 and the first 0 to follow. Then I'm going to attach the respective matching rdate to the anemia#s to create the start and end date. So for example I need 00RAJJ1P to take the dates from anemia2/rdate2 to anemia4/rdate4 and make those the start and enddate for that patient. For patient 00TS73B0 I would need a startdate and the enddate would be missing. for 00UQGCK2 start date and end date would be the two variables that are there.
... View more