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

why SAS PROC IMPORT twisted the values in EXCEL 2013 file?

 

We have EXCEL 2013 file with values such as C&IB, but after reading my PROC IMPORT, the results are C&IB.

 

Changed From     C&IB    to     C&IB   

 

Here is the code;

proc import datafile="&Maps./LOBOR_Map_samples.xlsx"

out=map

dbms=xlsx replace;

getnames=YES;

run;

 

Who knows what is wrong?

 

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions
Damo
SAS Employee

Hi @fankaiqing

 

This is a known issue with the XLSX engine, reported to R&D.

If you can't use @Reeza 's solution for now, a couple of other workarounds are:

  - Use the EXCELCS engine. You may have to install SAS PC Files Server.

  - Use the XLS engine (after you save your file to LOBOR_Map_samples.xls).

 

Hope that helps.

 

Cheers,
Damo

View solution in original post

4 REPLIES 4
Reeza
Super User
I don’t know why it happens, but you can use HTMLDECODE to correct the variables in question.

Damo
SAS Employee

Hi @fankaiqing

 

This is a known issue with the XLSX engine, reported to R&D.

If you can't use @Reeza 's solution for now, a couple of other workarounds are:

  - Use the EXCELCS engine. You may have to install SAS PC Files Server.

  - Use the XLS engine (after you save your file to LOBOR_Map_samples.xls).

 

Hope that helps.

 

Cheers,
Damo

fankaiqing
Fluorite | Level 6
Yes.

When I open the xlsx file, the value in the second column is with a formula relationship with the first column, For example, when you click the 3rd row cell of the second column, that is, B3 , the cell B3 will not show its value but "=A3". It means that this cell has relationship with the first column.

The solution is that we copy all its values in this xlsx file into another one to discard the formula, keep original values as text.

Thanks so much!
Kurt_Bremser
Super User

Open the .xlsx file with a ZIP program, and navigate to the \xl\worksheets folder within the file. Open sheet1.xml with a text editor.

When you scroll far enough to the right of the second line, you'll find that your values are stored like that (HTML encoding) by Excel; it seems that proc import gives you that string.

 

If you did the sensible thing and stored your table to a .csv file, and imported that, you would not have the problem.

For the umpteenth time: DO NOT USE EXCEL FILES FOR DATA TRANSFER!

 

BTW: your Excel file is 18K in size, the .csv created from that is just 1K. I rest my case.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 757 views
  • 1 like
  • 4 in conversation