The following documentation section discusses some aspect of RUN group processing including placement of ODS statements: https://documentation.sas.com/doc/en/statug/15.2/statug_ods_examples06.htm .