BookmarkSubscribeRSS Feed
Jack2012
Obsidian | Level 7

Dear All, 

 

Just facing a terrible issue when I try to reading from an simple external Excel file, and found there is Warning(figure1) and the problomatic result(figure2). 

 

The sas session is EUC-CN, I am hunting for the solution, please let me know if you have, and I would be highly appreciated. 

 

 

SAS CODE:

filename x "D:\sas code\encodingIssue\test.xlsx" encoding="utf-8";


proc import datafile=x out=test dbms=xlsx replace;getnames=yes;run;

Jack2012_0-1683253024537.pngJack2012_1-1683253038660.png

 

 

 

 

 

 

5 REPLIES 5
SASKiwi
PROC Star

I suggest you try the XLSX and EXCEL LIBNAMEs and see what your spreadsheet looks like in VIEWTABLE:

libname x XLSX "D:\sas code\encodingIssue\test.xlsx" encoding="utf-8";

libname x EXCEL "D:\sas code\encodingIssue\test.xlsx" encoding="utf-8";
Jack2012
Obsidian | Level 7
ERROR: Libref X is not assigned. ERROR: Error in the LIBNAME statement. ERROR 22-7: Invalid option name ENCODING. Thank you, but both snippet have above error.
ballardw
Super User

See if UTF-16 helps.

 

Note: search this forum for Excel and Import data problems.

If you are likely to have more than one file with the same data structure in the long run saving XLSX to a CSV format and reading that with a data step is much more consistent.

SASKiwi
PROC Star

Did you try without the ENCODING option? If not please try without that.

RD2
Fluorite | Level 6 RD2
Fluorite | Level 6

You need using SAS (Unicode Support) to run your code. 

sas-innovate-wordmark-2025-midnight.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!

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
  • 911 views
  • 0 likes
  • 4 in conversation