I think the title is hard to understand. I will give you a proper example of what I have and what I want.
I have this data for a lot of observations indicating the ID of