SAS Examples: Arrays and Variable Lists

Last updated:

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

Arrays in data step

Arrays are used in the data step.

SAS arrays are just another way to temporarily group and refer to SAS variables.

A SAS array is not a new data structure, the array name is not a variable, and arrays do not define additional variables.

  • Rather, a SAS array provides a different name to reference a group of variables.

Arrays in macros

The macro statement %Array(V,A B C) produces three macro variables, V1, V2, and V3, with corresponding values: A, B, and C and macro variable Dim V with the value 3.

These variables can then be used in the macro iterative loop statement %Do I = 1 %to &Dim V.;


References

Dialogue & Discussion