Hi
I am trying to read a text file containing english, numbers and Thai characters in it. I tried using the locale = th_Th option but it doesn't seem to be working. I am getting หนังซà¸à¸‡ 3 ชิ้น 100 à¹à¸¥à¸° in output dataset. I need to read thai characters correctly as well along with others. Can anyone help please?
options locale = th_TH;
proc import datafile = filej
out = test
dbms = dlm
replace;
delimiter = '|';
getnames= yes;
run;
Thanks!
Jitin Sethi
What SAS interface are you using? If it is the SAS Windowing System, then this SAS note may help: http://support.sas.com/kb/20/581.html
Or for Enterprise Guide: http://support.sas.com/kb/16/683.html
The National Language Support Guide: https://documentation.sas.com/?docsetId=nlsref&docsetTarget=p0wqfkbuw8h0qan1hzcvt8rs3f63.htm&docsetV...
Thanks for your reply. I am using SAS Enterprise Guide
Not sure what to change in language settings. can you please guide?
In SAS EG settings it says:
Display Language: English - English
Server Session Locale : Use the Enterprise Guide Display Language
@jitinsethi07 - I think you will need to install National Language Support for EG, before configuring. You can do that just by re-installing EG.
What's your current locale and encoding settings for the SAS Session?
Also, have you tried with UTF-8 encoding sesion?
Because, UTF-8 mostly handles all languages without any trouble.
Thanks for your reply Kalind.
Yes, agree with you, however, when I tried UTF-8 encoding, it removes all the thai characters and loads the file only with english characters and numbers in the columns.
Are you able to execute this command and can read thai data in UTF-8 session? If not then share the log output.
Proc options option=locale;run;
options locale=th_TH;
data;
infile datalines;
input test $30.;
datalines;
ดเวลาพักเที่
;;;;
run;
Proc options option=encoding;run;
Proc options option=locale;run;
Also, Are you getting any warnings in Log window when you try to import this file ?
If I run your program as it is, it spits out 'attached' error message:
Proc options option=locale;run;
options locale=th_TH;
data;
infile datalines;
input test $30.;
datalines;ดเวลาพักเที่;;;;
run;
If I run below code, where filej is my reference file from server location, there is no error but loads data with special character like this:
VCD หนัง 3 ชิ้น 100 à¹à¸¥à¸° à¸à
Proc options option=locale;run;
options locale=th_TH;
proc import datafile = filej
out = test
dbms = dlm
replace;
delimiter = '|';
getnames= yes;
run;
Your workspace server session does not use UTF-8 encoding, but LATIN1. Since the session encoding needs to be set at session startup, you need to change (or have changed) the workspace server configuration.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.