Storing and Using a List of Values in a Macro Variable
When using the macro language it is not at all unusual to need to manipulate a list of values. These may be a list of variables in a data set or even a list of data set names. Macro variables are often used to hold this list and there are a couple of storage options. Either each word of the list can be stored in its own indexed macro variable or, as discussed in this paper, one macro variable can be used to store the entire list.
The macro variable that contains this list of values can be created in a number of different ways including through the use of the DATA step or PROC SQL. Once created, the user will often want to step through the list performing one or more operations on each of the elements in the list, and this is often accomplished using a combination of the %DO statement and the %SCAN function.
This paper shows how to write a series of values to a single macro variable and then how to take advantage of the list by utilizing it from within the macro language.
View the pdf for this paper.