It would help a lot if you could provide some representative sample mock-up data (via a SAS data step) and then also show us how the desired result using this sample data should look like.
Providing sample data and desired result not only reduces ambiguity, it also allows us to provide tested code as answer.
... View more