You do have macro statements in your macro; when the macro is fed to the execution queue, these are resolved immediately, while all procedure and data step code has to wait until the calling data step finishes. This causes a timing mismatch between those two types of code.
To prevent premature execution of the macro statements, use the %NRSTR function:
call execute('%nrstr(%rnVARBOS('||dsn_nw||'));');
... View more