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

Hi Everyone,

As stated, when I export SAS file to Excel (xlsx), all characters variable become blank.

Any tips, please?

Thank you.

HHCFX

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

It sounds like your data file contains tags that are xml values and likely have something incomplete or out of order such as table, row or cell end or start markers without the matching start or end.

 

Normally I would say it is best would be to show the values in the data set for a few rows.

But with this error:

 XML error. (Strings) Illegal xml character. Line 1, column 9431.

I don't want to look at thousands of characters posted here. So I suggest looking very closely at your data.

View solution in original post

5 REPLIES 5
Cynthia_sas
Diamond | Level 26
Hi:
What code are you using? There are several methods to export from SAS to Excel -- LIBNAME engine, PROC EXPORT, ODS EXCEL, ODS CSV, ODS TAGSETS.EXCELXP. Without code it's hard to guess which method you're using. Also, what's your data like? Can you post a sample file?

Cynthia
hhchenfx
Rhodochrosite | Level 12

So I try to export multiple sheet to a Excel file.

I try to export 1 by 1 and download/open the excel file each time the export complete to see what is going on

 

1 - When it come to the a file, export goes no error. But when I open Excel, the notice show up

"We found a problem with some content in 'file name.xlsx'. Do you want us to try to recover as much as we can? if you trust the source of this workbook, click Yes.

When work book opened, all worksheets character variable are gone. These variable are user name and type of worker (say employee, contractor).

The error on Excel show up is:

Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
Removed Part: /xl/sharedStrings.xml part with XML error. (Strings) Illegal xml character. Line 1, column 9431.
Removed Records: Cell information from /xl/worksheets/sheet1.xml part
Removed Records: Cell information from /xl/worksheets/sheet2.xml part
Removed Records: Cell information from /xl/worksheets/sheet3.xml part
Removed Records: Cell information from /xl/worksheets/sheet4.xml part
Removed Records: Cell information from /xl/worksheets/sheet5.xml part
Removed Records: Cell information from /xl/worksheets/sheet6.xml part

 

2-When I export only those files I know working (based on the checking process above) all at once, the same issue show up.

 

The code I use:

 

	PROC EXPORT 
	 data=project_no_id
 		DBMS=xlsx 
	 outfile="&export_folder_EXCEL./Report_Projection.XLSx"
	 replace;			
	sheet="project_no_id";	
	run;

 

ballardw
Super User

It sounds like your data file contains tags that are xml values and likely have something incomplete or out of order such as table, row or cell end or start markers without the matching start or end.

 

Normally I would say it is best would be to show the values in the data set for a few rows.

But with this error:

 XML error. (Strings) Illegal xml character. Line 1, column 9431.

I don't want to look at thousands of characters posted here. So I suggest looking very closely at your data.

hhchenfx
Rhodochrosite | Level 12

Thanks a lot for your suggestion.

HHC

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 5623 views
  • 0 likes
  • 4 in conversation