SAS data sets are created
with the session encoding by default. You can specify a different
encoding for a new table by using the ENCODING= table option. ENCODING=
is supported for input only. You cannot change the encoding of an
existing table temporarily by specifying ENCODING= in the SELECT statement.
Likewise, you cannot change the encoding of an existing table permanently
by specifying it in the UPDATE statement.
Specify the ENCODING=
table option in the CREATE TABLE statement before the columns are
defined. Here is an example:
create table test {options encoding=ebcdic1145} (x char(8));
The ENCODING= table
option is not supported with CREATE TABLE AS. If you specify the table
option with CREATE TABLE AS, you get an error. The requested table
will be created, but it will use the session encoding. However, if
you use CREATE TABLE AS to insert an existing table that has an encoding
specified into a new table that has no encoding specified , then the
new table will have the encoding of the inserted table. For example,
the following request creates table Test2 with the encoding ebcdic1145
Spain (EBCDIC), which is the encoding used by table Test.
create table test2 as select * from test;