Help using Base SAS procedures

Proc Export to Excel result "corrupted"

Accepted Solution Solved
Reply
Super Contributor
Posts: 291
Accepted Solution

Proc Export to Excel result "corrupted"

Using this code in SAS 9.4 TS1M0 to produce a large xl file ...  (56 columns, 48,000 rows)

 

proc export data=GQBPlus_BU (where=(put(OwnerOpCd,$BUCd.)="&BUCode"))

Outfile= "\GQBPlus\&BuCode.\GQBPlus_&BUCode" /*path abbreviated*/

DBMS=xlsx Replace;

Sheet="Local&BUCode";

 

Upon opening the excel file, this message comes up:

 

We found a problem with some content in ... Full message attached as a jpg file. The file opens upon a Yes answer and Excel produces an uninformative log.

 

What needs to be changed to avoid the excel message?

 

Thank you,
Bill

 

 

 

 


Capture.JPG

Accepted Solutions
Solution
‎03-20-2017 11:54 AM
Super User
Posts: 10,500

Re: Proc Export to Excel result "corrupted"

I suspect the only way to not get a message from  Excel is to ensure the resultant file doesn't violate any of Excel's expectations.

 

What is the value of &bucode? You may be trying to create a sheet name excel doesn't like.

Another option would be to export to CSV and open that with Excel. At least with CSV you can see what your exported data looks like with any file viewer that supports plain text.

 

There may also be a problem if none of your records match your where criteria.

You might try making an actual subset of the data and not using a where dataset option.

 

any diagnostics from the Proc Export like 0 records written?

View solution in original post


All Replies
Solution
‎03-20-2017 11:54 AM
Super User
Posts: 10,500

Re: Proc Export to Excel result "corrupted"

I suspect the only way to not get a message from  Excel is to ensure the resultant file doesn't violate any of Excel's expectations.

 

What is the value of &bucode? You may be trying to create a sheet name excel doesn't like.

Another option would be to export to CSV and open that with Excel. At least with CSV you can see what your exported data looks like with any file viewer that supports plain text.

 

There may also be a problem if none of your records match your where criteria.

You might try making an actual subset of the data and not using a where dataset option.

 

any diagnostics from the Proc Export like 0 records written?

Super Contributor
Posts: 291

Re: Proc Export to Excel result "corrupted"

Thank you ballardw for your response.

 

An xl file is "successfully" produced with the code used. I don't see a problem with the file, but it is disconcerting for users to see the message. Hence I'd like to avoid the situation.

 

The value of &BUcode is PCR - xl should like that!

 

Tried the csv route and it works well. Users will be delighted!

 

Thanks,
Bill

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 203 views
  • 0 likes
  • 2 in conversation