Assigning av macro variable inside a macro creates a variable that is local to the macro.
To be able to refer to it outside the macro you need to add a %global before the assignment.
If you move the %put statement inside the macro, everything works.
Another responder has explained how %global also fixed the problem, but I would recommend instead of %global, you do all macro commands involving your macro variables INSIDE the macro.