

FCMP with DOSUBL would probably be the superior choice. I would argue the below is bad form, as you almost always can do it better without using macro variables - but this is how you would do it if you needed to. You don't get one per row unless you go to some extreme lengths, which usually can be done better without using macro variables. In those cases, you must run the macro prior to the datastep where you want the value - but you only get one (or a finite number of) return values. In those cases, unless you're using some FCMP elements such as DOSUBL, you will need to store the value somewhere, whether it is in a dataset or a macro. That would actually be more easily done in PROC FCMP (which compiles functions and subroutines), but sometimes macros are better for this (or you might not know FCMP well).įinally, some macros require procs or data steps of their own. What is PDV Program Data Vector (PDV) is the area of memory where data sets are created through the SAS system, one at a time. What is DATA Step The main function of a DATA step is to create SAS data sets by manipulating data. They can be used on the right side of an equal sign. A DATA step, which recovers and manipulates data A PROC step, which interprets the data 37. There are also function-style macros, that actually return a value to the data step (or in this case, return text that equates to a value). Simply contain the result in a data step variable, and if needed pass that variable's name as one of your arguments.

In that case, it is easier (and more stylistically correct) to not store a value in a macro variable. *this macro would be easier to do in an array, but it is an example So the contents of your macro need to either be text that could be executed inside a data step: %macro mymacro(numiters) Macros are not functions or subroutines they are text, just as if you'd typed it out (just saving some time with loops and conditionals). Macros that contain a proc or a data step are not executable inside of a data step.
