In reply to Rick Wicklin.

Rick, thanks for the comments and for the links to samples.

The question: can I write a macro to leverage the output of BY processing to a carefully arranged output using PROC DOCUMENT. Yes, I'll bet that I can. But that's a topic for another post; if someone else beats me to it, I'll be grateful.

One more comment about BY group efficiency - it's true that BY groups process the data just once, where this approach makes multiple passes. But imagine if you had SAS Grid Computing environment. With a few extra statements, you could easily spread the processing out to many different nodes, each processing one BY value. It would churn more I/O and compute cycles, but the clock time might be reduced. That tradeoff might be acceptable, depending on your business goals.