I tried some solutions already here and I am still unable to get a desired output.
The data I have is given below (ID is unique):
data have; inpu