DATA Step, Macro, Functions and more

SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

Reply
Super Contributor
Posts: 318

SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

I have a SQL Server table with chinese characters in it. I am able to view it properly through Base SAS (Unicode Suppport), but when I try to open it in Enterprise Guide, I hit the error "Unable to transcode data to/from UCS-2 encoding" upon clicking the dataset.

 

 


libname mydb odbc noprompt="driver=sql server;server=mysrv/db;uid=sa;pwd=pwd;database=mydb;" schema=dbo;

Greatly appreciate any inputs on this.

 

Thanks!

Super User
Posts: 9,681

Re: SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

Change your SAS encoding into UTF-8 .

Super Contributor
Posts: 318

Re: SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

The default is already in UTF-8.

 

I managed to resolve it by adding read permissions to the library and table itself in SMC and pre-assigning the library with metadata engine. 

 

I find it strange though that sometimes the error appears when you first open the table but once it's in the process flow it can actually be viewed properly.

Super User
Posts: 9,681

Re: SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

Make sure SAS has the same encoding with SQL .
Super Contributor
Posts: 318

Re: SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

[ Edited ]

Is it the collation in SQL Server? The database is Latin1_General_CI_AI and I can view chinese characters when I query in SQL Management Studio.

 

I'm actually able to view them now in SAS EG also, but when I filter by dates I get thrown again to a similar error.

Super User
Posts: 9,681

Re: SQL ODBC ERROR: Unable to transcode data to/from UCS-2 encoding

It is most likely unprinted character problem. E.X. you have half of a chinese word or a illegal character  for EG.

If that was it, you need clean your data before using EG.  

 

Also see if you could print it in HTML destination.

 

 

ods html;

proc print data=have(obs=100);run;

 

Ask a Question
Discussion stats
  • 5 replies
  • 150 views
  • 0 likes
  • 2 in conversation