Commands under OpenVMS |
OpenVMS specifics: | valid values for file-specification and encoding-value |
Syntax | |
Details | |
Examples | |
Example 1: Copying Text from a Window to a File | |
Example 2: Appending Text to an Existing External File | |
See Also |
Syntax |
FILE <file-specification><ENCODING='encoding-value'><option-list> |
a single filename. SAS writes the file in the current directory. If you enclose the filename in quotation marks, SAS uses the filename exactly as you specify it. If you do not enclose the filename in quotation marks and if you do not specify a filename extension, SAS uses .SAS, .LOG, or .LIS, depending on whether you issue the command from the Program Editor, Log, or Output window. If no filename extension is specified and the file-specification is longer than eight characters, then the default value is .DAT.
an entire pathname. SAS does not assume any filename extensions, even if you do not enclose the pathname in quotation marks.
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.
specifies options for the FILE command that are valid in all operating environments. For more information about these options, see the FILE command in the Base SAS section in the online SAS Help and Documentation.
Details |
The FILE command writes the entire contents of the current window to an external file without removing text from the window.
You can also use a physical filename (enclosed in quotation marks) in place of the fileref.
In this case, a dialog box first asks if you are sure you want to overwrite the file.
If you have not issued any FILE or INCLUDE commands, then an error message informs you that no default file exists. For a list of default file types used for the FILE command, see Default File Types.
Examples |
Suppose you have previously specified the following FILENAME statement:
filename sasfile '[mydir]program1.sas';
Issuing the following FILE command on the Program Editor command line copies the text from the Program Editor window into the file PROGRAM1.SAS:
file sasfile
To append text to an existing external file, use the APPEND option in the FILE command. For example, you can issue the following command from the Program Editor window to append the contents to the file associated with the fileref MYFILE:
file myfile append
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.