SAS Data Sets |
In the DATASETS procedure and the DATA step MERGE and SET statements, data set lists provide a quick way to reference existing groups of data sets. These data set lists can be numbered range lists or colon (name prefix) lists.
Numbered range lists require you to have a series of data sets with the same name, except for the last character or characters, which are consecutive numbers. In a numbered range list, you can begin with any number and end with any number. For example, the following two lists refer to the same data sets:
sales1 sales2 sales3 sales4 sales1-sales4
Note: If the numeric suffix of the first data set name contains leading zeros, the number of digits in the numeric suffix of the first and last data set name must be greater than or equal to the number of digits in the first data set name; otherwise, an error will occur. For example, the data set lists sales001-sales99 and sales01-sales9 will cause an error to occur. The data set list sales001-sales999 is valid. If the numeric suffix of the first data set name does not contain leading zeros, then the number of digits in the numeric suffix of the first and last data set names does not have to be equal. For example, the data set list sales1-sales999 is valid.
Colon (name prefix) lists require you to have a series of data sets with the same starting character or characters. For example, the following two lists refer to the same data sets:
abc: abc1 abc2 abcr abcx
In the DATASETS procedure, data set lists can be used with the following statements:
COPY SELECT
COPY EXCLUDE
DELETE
REPAIR
REBUILD
the variables that are specified in MODIFY SORTEDBY
For more information about how data set lists can be used in the DATA step, see the MERGE and SET statements in SAS Language Reference: Dictionary.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.