04-30-2015 08:24 AM
How can I pass a table column as a parameter in a macro?
Example of what I intend to do:
%macro looper (userid);
05-01-2015 03:53 AM
call execute('%looper ('||strip(user)||');');
However there are probably better ways of doing it, but without the rest of the information its hard to say.
05-01-2015 07:27 AM
One again I will remind you of the importance of timing with the macro language and the fact that CALL EXECUTE has subtleties that most do NOT understand.
The following example uses the %NRSTR macro quoting function to mask the macro statement. This function will delay the execution of macro statements until after a step boundary.
While it may not matter for the programs that you write we have not seen the OP's program and have no idea what the OP will come up with.
05-01-2015 03:20 PM
It would be considerate as well to explain why you want to perform such processing, as much as there may be a more effective / efficient technical approach - specifically what is your objective and how might you intend to use the SAS observation content with each macro invocation? It appears that LOOPER is intended to be a code-piece executed within the SAS DATA step you have illustrated, although you have the %MACRO %MEND definition coded after the RUN; statement which will most definitely short-circuit the processing you desire to achieve.