vexpand Expand abbreviated variable lists vexpand

SAS Macro Programs: vexpand

$Version: 1.0 (26 Jan 2006)
Michael Friendly
York University


The vexpand macro ( [download] get vexpand.sas)

Expand abbreviated variable lists

The VEXPAND macro expands a variables list of the forms: X1-X10, VARA--VARB, _NUMERIC_, _CHARACTER_ and returns the list of individual variable names. This is useful for procedures and macros that can only handle a blank-separated list of variable names.

Method

The program uses a data step array to capture the variable names and array processing to put them in a blank-separated list.

Usage

The VEXPAND macro is called with positional parameters. For example

   %let var = %vexpand(dataset, &var);

This macro can only be used at DATA/PROC step boundaries.

Parameters

DATA
The name of the input data set
VAR
List of variables to be expanded, usually a macro variable

See also

defined Determine if a macro variable is defined