BookmarkSubscribeRSS Feed
vinayp913
Calcite | Level 5

Integration technologies failed to submit the code. [Error] Failed to transcode data from utf-16le to wlatin1 encoding because it contained character which are not supported by your SAS session encoding. 

 

that's the dataset i am trying to run

Data Ex_3;
infile '‪‪D:\example_3.txt';
Input Name$ 1-7 height 9-10 weight 12-14;
BMI=700*weight/(height*height);
output;
run;

2 REPLIES 2
ballardw
Super User

See if this helps:

Data Ex_3;
infile '‪‪D:\example_3.txt' encoding='utf-16le';
Input Name$ 1-7 height 9-10 weight 12-14;
BMI=700*weight/(height*height);
output;
run;

This should tell SAS that the external file is that encoding and set up how to read it.

You may need to increase the number of "columns" read as some of the UTF-16 characters may take up more space when converted. You may also get some very interesting results depending on the actual source.

 

For what it is worth one of the first UTF-16 files I encountered had every character when read preceded by a space. What looked like "Fred" in the file was read as " F r e d".

Tom
Super User Tom
Super User

Two issues.

1) WLATIN1 is a single byte encoding. So it can only represent 256 distinct characters.  At least one of the characters in your file is not one of those characters.  To fix this you need to start SAS using a different encoding.  How to do that differs based on how you are running SAS.  If you have it installed on your PC look for "SAS 9.4 (Unicode support)" icon in your Start menu.

 

2) Fixed column input will not work well with Unicode characters.  Some characters use more than one byte, which will mess up the column counting.   Does the data contain a delimiter between the fields?  Post some of the lines of data as plain text instead of as an attachment.  Just open the text file in a text editor and copy a few lines and paste them into the pop-up window that appears when you click the Insert Code icon in the forum editor (the icon looks like the character string  < / > ).

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 590 views
  • 0 likes
  • 3 in conversation