BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RealePrimavera
Obsidian | Level 7

Hello SAS Colleagues,

 

I am encountering this error while working on a dataset that earlier imported from a websource:

"Failed to transcode data from utf-8 to utf-16le encoding because it contained characters which are not supported by your SAS session encoding..." (screen-shot attached).

 

I have already configured my SAS to "u8" version long before importing this data; and it is still the same. Also, I find this message is strange as usually it is reverse (as per my websearch). 

 

Moreover, also noticed: SAS 9.4 is 64-bit while Enterprise Guide is 32-bit. Not sure if this is causing the problem. 

 

It will be great if someone can help me 🙂

 

Thanks,SAS error message.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
RealePrimavera
Obsidian | Level 7

So, my solution for this error (credit goes to my project leader): 

 

first, to change back my sas configuration to "en" from "u8" that I was using for certain files. 

second, assign libname for folders of all "u8" sas files with the option "inencoding=wlatin2".

 

Hope this will be helpful for someone else like me encountering problems with characters. 

 

Thanks,

View solution in original post

5 REPLIES 5
koyelghosh
Lapis Lazuli | Level 10
Character encoding is a tricky thing to deal with.

I don't have access to Enterprise Guide but had I faced the same issue on SAS Studio,I would have done the below mentioned steps.

If you try to add "PUTLOG _ALL_" at the beginning of the DATA/PROC step and scan each line for _ERROR_ and _N_, you may find the first offending line (the value of _N_) where it says _ERROR_=1.
Open the file in the native program (using which the data file was written) or even notepad/vi is a good idea and go to that line and see which character is causing the error.

Please let me know if this was of any help.
Thank you.
RealePrimavera
Obsidian | Level 7

Sure @Vassilis .

 

1) You can change the configuration in the config. file that you should see in your C:. A path will be something similar to :

C:/program files/SAS Home/SAS Foundation/9.4/sasv9.cfg

This should open a text file where you can see nls\en\sasv9: change "en" to "u8".

(See for more details: https://documentation.sas.com/?docsetId=dplyml0phy0win&docsetTarget=p61010as31914aa4aa1477100150.htm...)

 

If you have special characters in excel file; this step should be enough.

 

2) But if in future you would need to convert this sas dataset again to english version (bz sometimes merging datasets require the same config in all datasets):

Then import with libname where you need to specify inencoding=wlatin1 or wlatin2.

 

(See for more details: https://documentation.sas.com/?docsetId=nlsref&docsetTarget=n02q3gv9mfdwnmn1ca9kqa3gbayl.htm&docsetV...

 

 

RealePrimavera
Obsidian | Level 7

So, my solution for this error (credit goes to my project leader): 

 

first, to change back my sas configuration to "en" from "u8" that I was using for certain files. 

second, assign libname for folders of all "u8" sas files with the option "inencoding=wlatin2".

 

Hope this will be helpful for someone else like me encountering problems with characters. 

 

Thanks,

Vassilis
Calcite | Level 5

Hello, 

I am facing the same problem while trying to import an excel file to Enterprise Guide. Can you please provide details about the changes you made? I cannot find the way to change SAS configuration or where to insert the "inencoding=wlatin2" option. Thank you in advance. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 9092 views
  • 4 likes
  • 3 in conversation