I really like Data_NULL_'s SUMMARY solution. It has the added advantage of allowing the top n values through the IDGROUP. Since the CLASS statement is being used the result is sorted on CLAIMID, but the incoming data need not be sorted.
The CLASS statement may have trouble when the data have very high cardinality. I don’t know just how big that number is.
I’ve been counting AES lately by SOC HLGT and PT with several thousand AES with no problem, granted that ain’t millions. When running on a multi processor system using CLASS instead of BY, MEANS/SUMMARY can produce astounding performance.
I would not eschew CLASS just because I “think” it might not work, I would find out first.