Accessing External Files |
You can use the * (asterisk) wildcard to specify file concatenations in the FILENAME, INFILE, and %INCLUDE statements and the INCLUDE command. The * matches one or more characters, except for the period at the beginning of filenames. The wildcard is supported for input only. You cannot use the wildcard in the FILE statement.
All of the pathnames in a concatenation must be for UNIX System Services (USS) files or directories. A wildcard character that generates a list of mixed file types results in an error.
The following rules apply to the use of the * wildcard:
The * must be in the filename part of the pathname.
Only one * can be included in any given filename.
Examples of the * wildcard follow:
An asterisk alone sets up a fileref that concatenates all of the files, except UNIX hidden files, in a given directory.
filename test '/u/userid/data/*';
A leading or trailing wildcard includes all files that begin or end with the same characters. A period selects all hidden UNIX files, which begin with a period.
include '/u/userid/data/test*'; include '/u/userid/data/*test.dat'; include '/u/userid/data/.*';
An embedded wildcard inputs all files that have both the same beginning and ending characters.
infile '/u/userid/data/test*file';
Wildcards that you use when you pipe data from SAS to USS commands are not expanded within the SAS session, but are passed directly to the USS commands for interpretation.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.