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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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