The FILENAME Statement

The FILENAME statement is a global SAS statement that manipulates filerefs. In IMLPlus, it is normally the case that you must place global SAS statements in a SUBMIT block or prefix the statement with the @ character. However, IMLPlus provides limited support for the FILENAME statement as a native IMLPlus statement.

The FILENAME statement has many different forms. IMLPlus only supports the following forms:

IMLPlus also supports an IMLPlus-specific form of the FILENAME statement that accepts an IML expression:

filename fileref (external-file-expression);

The external-file-expression argument must evaluate to a scalar character matrix. IMLPlus processes the FILENAME statement as if it were

filename fileref "evaluated-external-file-expression";

If you need to use a form of the FILENAME statement that is not supported by IMLPlus, you must submit the FILENAME statement to SAS for processing.

Examples

Example 1: Using the FILENAME statement with a string argument
filename txtfile "C:\MyData\MyFile.txt";
Example 2: Using the IMLPlus-specific FILENAME statement with an expression argument
pathname = "C:\MyData\MyFile.txt";
filename txtfile (pathname);
Example 3: Submitting a FILENAME statement with the @ character
@filename txtfile clear;
Example 4: Submitting a FILENAME statement with a SUBMIT block
f = "txtfile";
p = "C:\MyData\MyFile.txt";
submit fileref=f pathname=p;
    filename &fileref &pathname;
endsubmit;
Example 5: Submitting a FILENAME statement with the method SAS.SubmitStatements
statement = 'filename txtfile "C:\MyData\MyFile.txt";';
SAS.SubmitStatements( statement );