dev2r-geek

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.

0 Comments:

Post a Comment

<< Home


 

View My Stats