Macro Functions: How to Make Them - How to Use Them

From sasCommunity
Jump to: navigation, search

Abstract

The SAS® macro language includes a number of macro functions, such as %UPCASE, %QSCAN, and %SUBSTR. In addition a number of Autocall macros, such as %LEFT, %TRIM, and %VERIFY, are also supplied that act like macro functions. Macro functions are especially useful as programming tools, because the function call is replaced directly by the result of the call. Many macro programmers are unaware that they too can write useful macro functions.

Fortunately macro functions are not difficult to program. Not difficult, that is, if you know the simple techniques required to turn a macro into a macro function. This paper shows you how to create a macro function, the statements that you must avoid, and the technique used to “pass” the result of the function back to the calling program.


Online Materials

View the pdf for this paper.
You can down load the files associated with this Hands-on-Workshop: File:UserDefinedFormats.zip.

Contact Info

Please check out my user page. You can also email me.