Five Ways to Create Macro Variables: A Short Introduction to the Macro Language

From sasCommunity
Jump to: navigation, search

Abstract

The macro language is both powerful and flexible. With this power, however comes complexity, and this complexity often makes the language more difficult to learn and use. Fortunately one of the key elements of the macro language is its use of macro variables, and these are easy to learn and easy to use.

Macro variables can be created using a number of different techniques and statements. However the five most commonly methods are not only the most useful, but also among the easiest to master. Since macro variables are used in so many ways within the macro language, learning how they are created can also serve as an excellent introduction to the language itself. These methods include:

  • %LET statement
  • macro parameters (named and positional)
  • iterative %DO statement
  • using the INTO in PROC SQL
  • using the CALL SYMPUTX routine


Online Materials

View the pdf for this paper.

A ZIP file of the sample code associated with this HOW presentation is available for download here:File:ZQJ Carpenter.zip.

Contact Info

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