Look into CALL EXECUTE() instead.
You can call your macro directly from the data step without having to create macro variables or looping again.
PS. Your macro is not correct.
To make a macro first get working code for a single iteration.
Determine what's dynamic and make that into your macro variables.
If you're calling it for each name, then CALL EXECUTE is definitely the route to go.
Here's a fully worked example that would print a report for each age and sex combination in the data set.
https://gist.github.com/statgeek/beb97b1c6d4517dde3b2
... View more