ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
eagles_dare13
Obsidian | Level 7

I am trying to generate an excel file with this code:

ods html file="/home/&x rpt.xls" headtext="<style>

td {mso-number-format:\@}</style>";

       proc print data=&x uniform label;

          run;

ods html close;

&x is the macro that resolves to a name of a table.

When i generate this file on a unix box and copy the excel to a windows box and  try to open it, I get warning:

The file you are trying to open is in a different format than specified by the extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

When I click 'Yes', it opens fine.

My guess is that it is because in the ods, i say html and then save it as xls.. How to get around it?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

None of the ODS destinations generate a "native" excel file.

You can convert it on the windows side, not sure about Unix.

43496 - Convert files created using an ODS destination to native Excel files

It looks to be just a proc print, so why doesn't a proc export work?

View solution in original post

3 REPLIES 3
Chevell_sas
SAS Employee

This is because of the new Excel security feature beginning with Excel 2007 that matches the content and the extension. You can use the ExcelXP tagset and use the.XML extension, otherwise it would take a registry change to prevent the warning. See the below for more information.

http://support.sas.com/kb/31956

eagles_dare13
Obsidian | Level 7

Thank you. But i was hoping for an excel file and not an xml file Smiley Sad as output.

Reeza
Super User

None of the ODS destinations generate a "native" excel file.

You can convert it on the windows side, not sure about Unix.

43496 - Convert files created using an ODS destination to native Excel files

It looks to be just a proc print, so why doesn't a proc export work?

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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