Hello all, I've seen similar questions but none seem to be what I am looking for. I have one dataset with 2 variables I'd like to compare by ID. I can use proc compare but the rows start at different dynamic locations. I can't figure out how to either move my compare variable (x2) up to the correct row location or how to lag it behind to start at a dynamic location. Each id has a different number of groups. This is the data I have: id group x1 x2 1 1 4/16/2021 1 2 4/19/2021 1 3 4/28/2021 1 4 6/4/2021 1 1 4/16/2020 1 2 4/19/2021 1 3 4/28/2021 1 4 6/4/2021 2 1 8/12/2020 2 2 9/16/2020 2 3 10/8/2020 2 4 2/8/2021 2 5 9/29/2021 2 1 8/12/2020 2 2 9/16/2021 2 3 10/8/2020 2 4 2/8/2021 2 5 9/29/2021 And this is what I want (or at least a way to start the proc compare to lag by the max range in each id's group number): id group x1 x2 x3 x4 x5 1 1 4/16/2021 4/16/2021 4/16/2020 0 1 2 4/19/2021 4/19/2021 4/19/2021 1 1 3 4/28/2021 4/28/2021 4/28/2021 1 1 4 6/4/2021 6/4/2021 6/4/2021 1 1 1 4/16/2020 1 2 4/19/2021 1 3 4/28/2021 1 4 6/4/2021 2 1 8/12/2020 8/12/2020 8/12/2020 1 2 2 9/16/2020 9/16/2020 9/16/2021 0 2 3 10/8/2020 10/8/2020 10/8/2020 1 2 4 2/8/2021 2/8/2021 2/8/2021 1 2 5 9/29/2021 9/29/2021 9/29/2021 1 2 1 8/12/2020 2 2 9/16/2021 2 3 10/8/2020 2 4 2/8/2021 2 5 9/29/2021 Any help in the right direction would be awesome. Please and thank you!
... View more