BookmarkSubscribeRSS Feed
SASnewbie2
Fluorite | Level 6

Hi All, 

 

I received following error on my SAS program after I executed my program. Does anyone encounter error below and how you solve it. 

 

Error : Failed to transcode data from utf-16le to wlatin1 encoding because it contained characters which are not supported by your sas session encoding. Please review your encoding=and locale=SAS System options to ensure they can accomodate the data that you want to process. 

8 REPLIES 8
qoit
Pyrite | Level 9

You could either:

 

1. Use the COMPRESS functions to take out all the abnormalities:

compress(Variable_Name," '0D'x'0A'x",'kw')

 

2. Try use the data statement encoding option:

 

data want (encoding = 'utf-8');

set have;

run;

SASnewbie2
Fluorite | Level 6

Hi Qoit, 

 

Thanks for your advice

 

I encountered the error when i run the following coding, which I believe the causes was from the "where" function but there'are too many names and I have no idea what are the abnormalities that causes the error. 

 

I'd like to filter more than 10,000 name from my dataset. below are part of the filter names 

 

data work.table1
set WORK.QUERY_FOR_RESULTS_0000;
WHERE
(UPCASE(Name) LIKE '% HOLDING%' or
UPCASE(Name) LIKE '%ZUTALANT%' or
UPCASE(Name) LIKE '%ZURIAT W É%' or
UPCASE(Name) LIKE '%ZURAH VENTURES%' or
UPCASE(Name) LIKE '%ZURAH PREMIER%' or
UPCASE(Name) LIKE '%ZURAH PERMAI%' or
UPCASE(Name LIKE '%ZURAH IMPIAN%' or
UPCASE(Name) LIKE '%ZURAH ABADI%' );

run;

qoit
Pyrite | Level 9
Are you able to use the compress function to filter out unnecessary characters and then use the WHERE clause?

data want;
set have;
format name_ $1000. (rename=(name = name_));
name = compress(name_," '0D'x'0A'x",'kw');
drop name_;
run;

And now run your DATA Step.
andreas_lds
Jade | Level 19

Imho this is not a data-problem, but caused by chars in your program that are not compatible with the encoding of the sas session.

Ksharp
Super User
If it was a text file ,try option encoding=

filename x 'c:\tem\xx.csv' encoding='utf-16le';
Sajid01
Meteorite | Level 14

If possible copy your code to  notepad and then copy back to SAS Eg in a new program window and try

Tom
Super User Tom
Super User

@SASnewbie2 wrote:

Hi All, 

 

I received following error on my SAS program after I executed my program. Does anyone encounter error below and how you solve it. 

 

Error : Failed to transcode data from utf-16le to wlatin1 encoding because it contained characters which are not supported by your sas session encoding. Please review your encoding=and locale=SAS System options to ensure they can accomodate the data that you want to process. 


If you want to work with that data you need to run SAS in a session that is using a non-single byte encodings.  With only a single byte encoding WLATIN1 there are only 256 possible characters that can be represented and the one it is complaining about is not one of them. 

 

How are you running the program now?  Are you running from a command line?  Clicking on something?  Using SAS/Studio or Enterprise Guide or other user interface that allows you to run SAS code.  Check with your local SAS support about how to run SAS with unicode support in your environment.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1588 views
  • 0 likes
  • 6 in conversation