In reply to John.

Thanks for writing. To clarify, I meant "if the [DATA step] contains an OUTPUT statement anywhere in the [DATA step], ..."

For readers who might be unfamiliar with By-group processing in the DATA step, see the article "How to use FIRST.variable and LAST.variable in a BY-group analysis in SAS".