- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I guess my SAS session has encoding WLATIN1, while my SAS data file has UTF-8 encoding. I need to change my SAS session's encoding to UTF-8. I tried the following code but did not work. I appreciate it if you may guide me. Thanks!
data SAS_data;
set name_lib.data;
ENCODING='UTF-8';
OPTIONS NOFMTERR;
run;
name_lib.data
.DATA is in a format that is native to another host, or the file encoding does not match the
name_lib.data
. Either the data contains charactersproc options option=config; run;
proc options group=languagecontrol; run;
proc options option=encoding; run;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc options option=config; run;
SAS (r) Proprietary Software Release 9.4 TS1M7
CONFIG=( "C:\SAS\Config\Lev1\SASApp\WorkspaceServer\sasv9.cfg" "C:\SAS\Config\Lev1\SASApp\sasv9.cfg" "C:\Program
Files\SASHome\SASFoundation\9.4\sasv9.cfg" "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
"C:\SAS\Config\Lev1\SASApp\sasv9_usermods.cfg" "C:\SAS\Config\Lev1\SASApp\WorkspaceServer\sasv9_usermods.cfg" )
Specifies the configuration file that is used when initializing or overriding the values of SAS system options.
NOTE: PROCEDURE OPTIONS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
74 proc options group=languagecontrol; run;
SAS (r) Proprietary Software Release 9.4 TS1M7
Group=LANGUAGECONTROL
DATESTYLE=MDY Specifies the sequence of month, day, and year when ANYDTDTE, ANYDTDTM, or ANYDTTME informat data is ambiguous.
DFLANG=LOCALE Specifies the language for international date informats and formats.
DSCAS Runs the DATA step on the CAS server.
EXTENDOBSCOUNTER=YES
Specifies whether to extend the maximum number of observations in a new SAS data file.
LOCALEDATA=SASLOCALE
Specifies the location of the locale database.
NOLOGLANGCHG Disables changing the language of the SAS log when the LOCALE= option is changed.
NOLOGLANGENG Write SAS log messages based on the values of the LOGLANGCHG, LSWLANG=, and LOCALE= options when SAS started.
LSWLANG=LOCALE Specifies the language for SAS log and ODS messages when the LOCALE= option is set after SAS starts.
MAPEBCDICTOASCII= Specifies the transcoding table that is used to convert characters from ASCII to EBCDIC and EBCDIC to ASCII.
NONLDECSEPARATOR Disables formatting of numeric output using the decimal separator for the locale.
NOODSLANGCHG Disables changing the language of the SAS message text in ODS output when the LOCALE option is set after start
up.
PAPERSIZE=LETTER Specifies the paper size to use for printing.
RSASIOTRANSERROR Displays a transcoding error when illegal values are read from a remote application.
TIMEZONE='GMT-04:00'
Specifies a time zone.
TRANTAB=(lat1lat1,lat1lat1,wlt1_ucs,wlt1_lcs,wlt1_ccl,,,)
Specifies the translation table catalog entries.
URLENCODING=SESSION
Specifies whether the argument to the URLENCODE function and to the URLDECODE function is interpreted using the
SAS session encoding or UTF-8 encoding.
NODBCS Disables double-byte character sets.
DBCSLANG=NONE Specifies a double-byte character set language.
DBCSTYPE=NONE Specifies the encoding method to use for a double-byte character set.
ENCODING=WLATIN1 Specifies the default character-set encoding for the SAS session.
LOCALE=EN_US Specifies a set of attributes in a SAS session that reflect the language, local conventions, and culture for a
geographical region.
NONLSCOMPATMODE Encodes data using the SAS session encoding.
NOTE: PROCEDURE OPTIONS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
75 proc options option=encoding; run;
SAS (r) Proprietary Software Release 9.4 TS1M7
ENCODING=WLATIN1 Specifies the default character-set encoding for the SAS session.
NOTE: PROCEDURE OPTIONS used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
76
77 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
89
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Do you need to process UTF-8 encoding data sets within the current session?
The easiest way is to use the SAS Unicode version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You just need to add the following line to your file:
C:\SAS\Config\Lev1\SASApp\sasv9_usermods.cfg
-ENCODING = UTF-8
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Emma_at_SAS wrote:
Thanks, SASKiwi. How do I exactly add ENCODING = UTF-8 to my file?
Edit it with Notepad. SAS cfg files are simple text files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If your sas was stand alone PC version . Try Unicode version sas.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks everyone! Using the SAS(Unicode) session was the easiest way I could use to read my whole data.
In this SAS environment (Unicode), I see an extra column as ENCODING (Char). Is everything in this environment work similar to the regular SAS(DBCS) session and saved normally to be used in the other environment later? Is there anything I should be careful about?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes.
"and saved normally to be used in the other environment later?"
No. only for utf-8 encoding environment .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No. only for utf-8 encoding environment.
--> So, the code from the SAS(UNICODE) works well for two environments: SAS(UNICODE) and the UTF-8 encoding environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, everyone!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS(UNICODE) IS JUST (equal) UTF-8 encoding environment.