Previous Page | Next Page

SAS Functions and CALL Routines under Windows

FILENAME Function: Windows



Assigns or deassigns a fileref for an external file, directory, or output device.
Category: External Files
Windows specifics: device types and host options
See: FILENAME Function in SAS Language Reference: Dictionary

Syntax
Details
Example

Syntax

FILENAME ("fileref", "filename" <,device-type<,host-options<,dir-ref>>>)

fileref

in a DATA step, specifies the fileref to assign to the external file. In a macro (for example, in the %SYSFUNC function), fileref is the name of a macro variable (without an ampersand) whose value contains the fileref to assign to the external file. (See SAS Language Reference: Dictionary for details.)

Under Windows, fileref can also be a Windows environment variable. The fileref or the environment variable that you specify must be enclosed in quotation marks.

filename

specifies the external file. Specifying a blank filename clears the fileref that was previously assigned.

Under Windows, the filename differs according to the device type. Reserved Windows Physical Names shows the information that is appropriate to each device. The filename that you specify must be enclosed in quotation marks.

device-type

specifies type of device or the access method that is used if the fileref points to an input or output device or location that is not a physical file. It can be any one of the devices that are listed in FILENAME statement device-type argument. DISK is the default device type.

host-options

are options that are specific to Windows. You can use any of the options that are available in the FILENAME statement. See the FILENAME statement host-option-list.

dir-ref

specifies the fileref that is assigned to the directory in which the external file resides.


Details

FILENAME returns a value of 0 if the operation was successful, and a non-zero number if the operation was not successful.


Example

For an example of using the FILENAME function, see Example of Obtaining File Information.

Previous Page | Next Page | Top of Page