BookmarkSubscribeRSS Feed
Mayt
Quartz | Level 8

Hi everyone!

I have connected SAS code to SQLserver but the dataset  can't display Thai character. But when I have tried connecting SAS code to PostgreSQL, it works  and displays Thai character perfectly fine. However I need to connect with SQLserver. Please advise me. Thank you in advance.

My code:

libname sslib1 sqlsvr noprompt="DRIVER=SAS ACCESS to MS SQL Server;
UID=my UID ;PWD=my Password;
HOST=My host ;PORT=My port; schema=dbo";

And some columns  appear like this:

Any Thai character appears as � 

Mayt_0-1696407947782.png

While the dataset connected with PostGreSQL

Mayt_1-1696410486236.png

 

I have tried 

1.

libname sslib1 sqlsvr noprompt="DRIVER=SAS ACCESS to MS SQL Server;
UID=my UID ;PWD=my Password;
HOST=My host ;PORT=My port; client_encoding='UTF-8'; schema=dbo";

2. or add

proc options option=encoding;
run;

3. or create a new table

proc sql;
create table work.test(encoding='utf8') as
SELECT * FROM sslib1.mytable(encoding='utf8');
quit;

But still Thai characters appears as � 

2 REPLIES 2
JosvanderVelden
SAS Super FREQ
What is the encoding used in the sas session? Is sqlserver running on windows or unix? Is sas running on windows?
Mayt
Quartz | Level 8
- Encoding used in the sas session is UTF8
- SQLserver is running on windows
- SAS is running on unix

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 1107 views
  • 0 likes
  • 2 in conversation