|Statements under OpenVMS|
|Valid:||in a DATA step|
|OpenVMS specifics:||valid values for file-specification, host-option-list, and encoding-value|
|See:||FILE Statement in SAS Language Reference: Dictionary|
FILE file-specification <ENCODING='encoding-value'><option-list>
can be any type of file specification discussed in Identifying External Files to SAS.
For valid encoding values, see Encoding Values in SAS Language Elements in SAS National Language Support (NLS): Reference Guide.
For information about these options, see Host-Specific External I/O Statement Options in the FILENAME statement.
Many of the DCL print qualifiers are also supported as host options in the FILE and FILENAME statements. For details, see Printer Options in the FILENAME and FILE Statements in the FILENAME statement.
Note: When using the PIPE device with the FILE statement, only the LRECL host option is supported.
By default, PUT statement output is written to the SAS log. Use the FILE statement to route this output to either the same external file to which procedure output is written or to a different external file. You can indicate whether carriage-control characters should be added to the file.
The ENCODING= option is valid only when the FILE statement includes a file specification that is not a reserved fileref. If the FILE statement includes the ENCODING= option and the reserved filerefs LOG or PRINT as the file-specification, then SAS issues an error message. The ENCODING= value in the FILE statement overrides the value of the ENCODING= system option.
This FILE statement uses the default filename form of the file specification (PRICES has not been assigned as a SAS fileref or OpenVMS logical name). Therefore, SAS looks for the file PRICES.DAT in the current directory.
When SAS writes a file, it creates a new version by default. For example, if your default directory contains versions 1 and 2 of the file PRICES.DAT, then this FILE statement writes PRICES.DAT;3 in your default directory.
If you want to append output lines to the most recent version of an external file, use the MOD option in the FILE statement. For instance, from the previous example your default directory contains three versions of PRICES.DAT. The following statement appends data lines to PRICES.DAT;3: