CORRECTENCODING= Option
Explicitly changes the encoding attribute of a SAS
file to match the encoding of the data in the SAS file.
Valid in: |
MODIFY statement of the DATASETS procedure |
Syntax
MODIFY SAS
file </<CORRECTENCODING=encoding-value>> ;
Optional Argument
- </ <CORRECTENCODING=encoding-value> >
-
enables you to change
the encoding indicator, which is recorded in the file's descriptor
information, in order to match the actual encoding of the file's data.
You cannot use this option in parenthesis after the name of each SAS
file; you must specify CORRECTENCODING= after the forward slash. For
example:
modify mydata / correctencoding=latin2;
Restriction:CORRECTENCODING= can be used only when the SAS file uses
the default base engine, which is V9 in SAS 9.
Example: Using the CORRECTENCODING= Option to Resolve a SAS Session
Encoding and a SAS File Encoding
A file's encoding indicator
can be different from the data's encoding. For example, a SAS file
that was created before SAS 9 has no encoding indicator stored on
the file. If such a SAS file that has no recorded encoding is opened
in a SAS 9 session, SAS assigns the encoding of the current session. For
example, if the encoding of the data is Danish EBCDIC, but the encoding
for the current session is Western Wlatin1, then the actual encoding
of the file's data and the encoding indicator that is stored in the
file's descriptor information do not match. When this action occurs,
the data does not transcode correctly and could result in unreadable
output. The following MODIFY statement would resolve the problem by
explicitly assigning an EDCDIC encoding:
Note: CEDA creates a read-only
copy. You need to copy the data with PROC COPY or a DATA step to transcode
the data permanently.
proc datasets library=myfiles;
modify olddata / correctencoding=ebcdic1142;
quit;