BookmarkSubscribeRSS Feed
jitinsethi07
Obsidian | Level 7

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

8 REPLIES 8
SASKiwi
PROC Star

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...

jitinsethi07
Obsidian | Level 7

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

 

SASKiwi
PROC Star

@jitinsethi07  - I think you will need to install National Language Support for EG, before configuring. You can do that just by re-installing EG.

Kalind_Patel
Lapis Lazuli | Level 10

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.

 

jitinsethi07
Obsidian | Level 7

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.

Kalind_Patel
Lapis Lazuli | Level 10

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 ?

jitinsethi07
Obsidian | Level 7

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;

Kurt_Bremser
Super User

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-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 3249 views
  • 0 likes
  • 4 in conversation