BookmarkSubscribeRSS Feed
JoshuaHarris
Obsidian | Level 7
Am importing an excel which contains some Latin characters as well. As it's not read properly, i googled and learnt that we can save the excel as unicode text file and then use proc import with encoding of utf-16.
Now am able to read it. But the dataset contains some extra symbols came along with latin characters.
Example
 became Â-> or Âf like this.
How to read this properly and also how to process using string functions like cats and then report it back to excel properly with no extra symbols or letters.
Note: am using SAS for windows(9.3)
Thanks
3 REPLIES 3
s_lassen
Meteorite | Level 14

If you save your Excel file as Unicode text, you should also use unicode to read it into SAS:

Filename Textfile '<path>' ENCODING='UTF16B';
data want;
  infile textfile;
  input....

But I do not quite understand that only some characters get converted to two bytes - according to the SAS documentation, the UTF-16 encodings store all characters as two bytes. Are you quite sure that you are not using UTF-8?

 

ballardw
Super User

FWIW I didn't find a UTF-16 save as option in my Excel 365, only UTF-8 and UTF-BigEndian

JoshuaHarris
Obsidian | Level 7
I saved it as unicode text and read the file again with utf-16.
Found a workaround for this temporarily.
Only few number of rows contains this special encoding data. So filtered
out using excel filter option on that column and copied it to notepad and
replace all there with space and copy back to excel solves my problem

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 4428 views
  • 0 likes
  • 3 in conversation