Chapter Contents |
Previous |
Next |
FILE |
Language element: | statement |
Valid: | in a DATA step |
OpenVMS specifics: | valid values for file-specification; valid values for host-option-list |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
FILE file-specification
<option-list>
|
ALQ= | KEYVALUE= | NEW |
CC= | LINESIZE= | OLD |
DEQ= | LRECL= | PAGESIZE= |
FAC= | MBC= | RECFM= |
GSFCC= | MBF= | SHR= |
KEY= | MOD |
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.
You can intersperse options from option-list and host-option-list in any order.
Note: When using the PIPE device with the FILE statement, only the LRECL
host option is supported.
Details |
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 or not carriage control characters should be added to the file.
You can use the FILE statement in conditional (IF-THEN) processing because it is executable. You can also use multiple FILE statements to write to more than one external file in a single DATA step.
Example |
The following is an example of a FILE statement:
file prices;
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, the SAS System looks for the file PRICES.DAT in the current directory.
When the SAS System 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:
file prices mod;
To reference an explicit version of a file, use the version number as part of the file specification within a quoted string. For example, the following FILE statement writes to version 1 of the file:
file 'prices.dat;1';
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.