That brought to mind a SGF paper by one of my favorite authors. :)

I used endsas within a macro as needed.

https://support.sas.com/resources/papers/proceedings11/005-2011.pdf