FILE Command: Windows

Writes the contents of the current window to an external file.
Windows specifics: valid options

Syntax

FILE file-specification <ENCODING='encoding-value'> <portable-options> <host-options>

Required Arguments

file-specification
specifies a valid Windows external file specification, such as a fileref, a file shortcut, a Windows filename that is enclosed in quotation marks, an environment variable, or an unquoted filename that resides in the current directory.
ENCODING='encoding-value'
specifies the encoding to use when writing to the output file. The value for ENCODING= indicates that the output file has a different encoding from the current session encoding.
When you write data to the output file, SAS transcodes the data from the session encoding to the specified encoding.
For valid encoding values, see Encoding Values in SAS Language Elements in SAS National Language Support (NLS): Reference Guide.
portable-options
specifies one or more portable options, which are documented under the FILE command in SAS Help and Documentation.
host-options
BLKSIZE=block-sizeBLK=block-size
specifies the number of bytes that are physically read or written in an I/O operation. The default is 8192. The maximum is 1 megabyte.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
LRECL=record-length
specifies the record length (in bytes). Under Windows, the default is 256. The value of record-length can range from 1 to 1,073,741,823 ( 1 gigabyte).
RECFM=record-format
controls the record format. Under Windows, the following values are valid:
F indicates fixed format.
N indicates binary format and causes the file to be treated as a byte stream. If LRECL is not specified, by default SAS reads 256 bytes at a time from the file.
P indicates print format.
S370V indicates the variable S370 record format (V).
S370VB indicates the variable block S370 record format (VB).
S370VBS indicates the variable block with spanned records S370 record format (VBS).
V|D indicates variable format. This is the default.

Details

The FILE command writes the entire contents of the active window to an external file without removing text from the window.
If you do not specify a file-specification, then SAS uses the filename from the previous FILE or INCLUDE command. In this case, SAS first asks you if you want to overwrite the file and provides you with these selections:
  • Replace
  • Append
  • Cancel
If you have not issued any FILE or INCLUDE commands, you receive an error message indicating no default file exists.
In the Enhanced Editor, if the filename is eight characters or less, the file extension of .SAS is appended to file-specification. No extension is appended for a file-specification longer than eight characters.

See Also

“FILE Command” in the SAS Help and Documentation
ENCODING= Option in SAS National Language Support (NLS): Reference GuideSAS National Language Support (NLS): Reference GuideSAS Companion for Windows
“Referencing External Files” in the “Using External Files” section in SAS Companion for Windows
“Using the FILE Command” in the “Using External Files” chapter in SAS Companion for Windows
For an example of using some of these options, see “Advanced External I/O Techniques” in the “Using External Files” section in SAS Companion for Windows