- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
show your exporting code would help.
are you exporting to xls using excelcs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your quick response.
I am using EXCEL 2010 but the code is saying that .xls
For 2007 above versions we need to keep .xlxs extension ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Reeza is correct. The file extension you use will depend on the ODS statements. For example, if you are using TAGSETS.EXCELXP, the correct file extension is .XML, NOT .XLS - otherwise, Excel will complain with exactly the message you describe.
My recommendation is that you should change the code and use the file extensions shown in Reeza's post. Or else, change the registry, as described in this Tech Support note: http://support.sas.com/kb/31/956.html .
Hope this helps,
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ODS HTML FILE='/sas/sai/repeat_faults2.xls;
ODS HTML CLose;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ODS TAGSETS.EXCELXP is as close as you can get and you need to use the XML extension. It does most of what ODS EXCEL does, just doesn't give a native Excel file. You could convert it after the fact, there's a vbs macro that does that on sas support website.