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

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!
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.

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