Previous Page | Next Page

SAS Statements under Windows

FILE Statement: Windows



Specifies the current output file for PUT statements.
Valid in: a DATA step
Windows specifics: Valid values for file specification; valid values for encoding-value; valid options for host-option-list
See: FILE Statement in SAS Language Reference: Dictionary

Syntax
Details
See Also

Syntax

FILE file-specification<ENCODING='encoding-value'><option-list> <host-option-list>;

file-specification

can be any of the file specification forms discussed in Referencing External Files.

Note:   The words AUX, CON, NUL, PRN, LPT1 - LPT9, and COM1 - COM9 are reserved words under Windows. Do not use them as filenames.   [cautionend]

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.

host-option-list

names external I/O statement options that are specific to the Windows operating environment. They can be any of the following:

BLKSIZE=block-size
BLK=block-size

specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.

BLOCK | NOBLOCK

is used only in the context of named pipes. This option indicates whether the client is to wait if no data is currently available. BLOCK is the default value.

BYTE | MESSAGE

is used only in the context of named pipes. This option indicates the type of pipe. BYTE is the default value.

COMMAND

is used only in the context of Dynamic Data Exchange (DDE). This option enables you to issue a remote command for applications that do not use the SYSTEM topic name. For more information, see Referencing the DDE External File and Controlling Another Application Using DDE.

EOFCONNECT

is used only in the context of named pipes and is valid only when defining the server. This option indicates that if an end-of-file (EOF) character is received from a client, the server should try to connect to the next client.

HOTLINK

is used only in the context of Dynamic Data Exchange (DDE). For a complete description and an example of using this option, see Using the DDE HOTLINK.

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).

Alternatively, you can specify a logical record length value by using the LRECL= system option.

MOD

specifies that output should be appended to an existing file.

NOTAB

is used only in the context of Dynamic Data Exchange (DDE). This option enables you to use non-tab character delimiters between variables. For more information about this option, see Using the NOTAB Option with DDE.

RECFM=record-format

controls the record format. The following values are valid under Windows:

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 format is the default.

The S370 values are valid with z/OS types of files only. That is, files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format z/OS, first copy it to a variable-length, binary z/OS file.

RETRY=seconds

is used only in the context of named pipes. This option specifies how long a named pipe client should wait for a busy pipe. The minimum (and default) value for seconds is 10.

SERVER | CLIENT

is used only in the context of named pipes. This option specifies the mode of a named pipe. The default value is SERVER.

TERMSTR=

specifies the end-of-line character for the file. Use this option to share files between the UNIX and Windows operating environments. Valid values are:

CRLF

Carriage return line feed. Use TERMSTR=CRLF to write Windows formatted files. CRLF is the default.

LF

Line feed. Use TERMSTR=LF to write UNIX formatted files.

NL

New line. Use TERMSTR=NL to write UNIX formatted files.


Details

The FILE statement routes the output from the PUT statement to either the same external file to which procedure output is written or to a different external file.

If the FILE statement includes the ENCODING argument and the reserved filerefs LOG or PRINT as the file-specification, SAS issues an error message. The ENCODING value in the FILE statement overrides the value of the ENCODING system option.


See Also

Previous Page | Next Page | Top of Page