/users/pat/cars
infile '/users/pat/cars';The following FILE statement directs output to a specified special device file:
file '/dev/ttyp1';
/users/mkt/report
and it includes file qtr.sas
, you can reference qtr.sas
in any of the following statements: %include '/users/mkt/report/qtr.sas'; %include 'qtr.sas'; file 'qtr.sas';If there is no
qtr
fileref already defined, you can omit the quotation marks and the
filename extension in the %INCLUDE statement: %include qtr;
PROGRAM
is not the same
as a file named program
. When you reference
the name of a file that is written in mixed case or uppercase, and
that filename is not enclosed in quotation marks, SAS converts the
filename to lowercase. If the filename does not have a file extension,
SAS adds the missing file extension.
TEMP
to temp
, and adds an extension of .sas to the filename:
filename inc_code 'your-directory';
%include inc_code(TEMP);
WARNING: Physical file does not exist, A.../your-directory/TEMP.sas.
ERROR: Cannot %INCLUDE member TEMP in the aggregate INC_CODE.
The warning message shows only the original filename (TEMP.sas),
and not the lowercase conversion (temp.sas). This situation might
cause confusion if a file named TEMP.sas does exist.%include code(TEMP.sas); %include code("TEMP");In both of these cases, SAS does not convert TEMP to lowercase.
filename subfiles '*/*'; data; infile subfiles; input; run;If new files are added to any of the subdirectories, they can be accessed with the Subfiles fileref without changing the FILENAME statement.
filename curdir "."; data; infile curdir('wild*'); input; run;In the example above, the period in the FILENAME statement refers to the current directory.
filename myref '[a-zA-Z]*.dat';The following statement associates MyRef with any file beginning with Sales (in either uppercase, lowercase, or mixed case) and a year between 2010 and 2019:
filename myref '[Ss][Aa][Ll][Ee][Ss]201[0-9].dat';