@WZ wrote:
..Do I make my question clear?
Not exactly.
Some example data, fake is fine, with a similar structure showing enough variables and records to demonstrate the cases with the desired output will help.
If have some data in a SAS data set Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712 will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
... View more