Data Set Lists

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 occurs. For example, the data set lists sales001–sales99 and sales01–sales9 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 Statement in SAS Statements: Reference and the SET Statement in SAS Statements: Reference.