Recently I am facing an Issue with Excel when we Write an ODS Statement .When the Program is completed and when I receive an email and open that excel file I am getting the below Error:
the file you are trying to open is in a different format than specified by the file extension .
That means that the extension on the file does not match the content. Your system is warning you that someone might be trying to fool you into opening a file that might be dangerous.
If you use ODS EXCEL then the extension on the file should be XLSX as that is the format it generates.
If you use ODS TAGSETS=excelxp then the extension on the file should be XML as that is the format it generates.
If you use ODS CSV then extension is CSV.
If you use ODS HTML then extension is HTML.
etc.
show your exporting code would help.
are you exporting to xls using excelcs?
You can do a simple test: if you can open the file with some kind of zip program (winzip, 7zip) and see content, then it should have the .xlsx extension.
@saikiran_nemani wrote:
Recently I am facing an Issue with Excel when we Write an ODS Statement .When the Program is completed and when I receive an email and open that excel file I am getting the below Error:
the file you are trying to open is in a different format than specified by the file extension .
ODS statement code please.
You try to lie to Excel, disguising a HTML file as an Excel file, and Excel rightfully complains about this.
Use the proper extension:
ODS HTML FILE='/sas/sai/repeat_faults2.html';
and open the file from within Excel (do not double-click the file in Explorer).
Excel can read html files with tables.
Otherwise, use the correct ODS destination:
ODS EXCEL FILE='/sas/sai/repeat_faults2.xlsx';
as @Reeza already told you.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.