SAS | How to specify a list of Variables?
Suppose you have a list of variables. You don’t want to type the name of each variable every time to define them within the function or array. You are looking for a shortcut to accomplish this task.
Create a dataset with a list of variables
How to specify a list of variables
A single dash (-) refers to specify consecutive numbered variables. For example: a1-a4;
A double dash (–) refers to specify variables based on the order of the variables as they appear/entered in the file, regardless of the name of the variables.
In the above program, a1-a4 includes a1, a2, a3 and a4, whereas a1--a4 includes a1, a3 and a4 only as they appear the same way in file.
How to specify all NUMERIC variables
How to use double dash in array
The below-defined program will subtract one from values in variables a1, a3 and a4.
How to use numeric variables in array
The below-defined program will subtract one from values in numeric variables.