Where are your ODS HTML Close statements?
If you are going to attempt macro programming you will want to make sure that every Procedure has a RUN at the end and that you matching open/closes for thing like Ods destinations.
You should also show how/where call the macro as code before and after may make a difference.
If you add:
Options mprint;
before where you call your macro you can see in the log more details of the code as generated.
Use Options nomprint; to turn this off.
Then look in your generated code for where things like RUN and close should be.