Tuesday, November 01, 2005

Calling a macro from a SAS data step

1) The CALL EXECUTE statement inside a data step will delay execution of the macro until runtime.

Although this has its advantages (you can pass a variable from each observation and compute to your heart's content), it has a big disadvantage: A CALL SYMPUT inside the macro doesn't instantaneously create the SYMPUT variable. This makes CALL EXECUTE particularly useless as a function inside a loop (to speak in normal programming terms).

The workaround? Jeff suggests placing the entire data step inside the macro thus avoiding any macro variable passing between data step and macro call. Thus, instead of passing a variable name as a macro parameter, pass the entire dataset name and add a new variable inside to the dataset inside the macro.


  • Forbes Cover Story Cites the Evils of Blogs
    The cover story of Forbes cries, "Attack of the Blogs." The article, written by Daniel Lyons, isn't referring to the mass amount of people blogging and how you just can't seem to escape a blog post these days.
    Find out how to buy and sell anything, like things related to road construction safety equipment on interest free credit and pay back whenever you want! Exchange FREE ads on any topic, like road construction safety equipment!

    By Blogger Susan Hanson, at 10:56 AM  

Post a Comment

<< Home


View My Stats