I am using SAS 9.1.3 and xlsx (MSoffice 2007).
I had a very nice little routine that would place my output into an excel spread sheet.
When I tried to replicate for a new project this month, I got an error when I tried to open the XML with excel.
The error I get when I go to open my ODS output is: Problem during load - Problem came up in the following areas during load: Workbook setting.
This file cannot be opened because of errors. Errors are listed in: C:\Documents and settings\ect..etc... .
The ODS output xml that opens in excel is very important to me.
Thank you in advance for any help provided,
HERE IS MY SAS CODE - tried it with the program that worked before, tried in my new program, and tried it in a sasuser data set. No mater which data set, the output would not open in excel.
data work.usethis ;
ODS Escapechar = '~';
options nonumber /*supresses automatic page number at top of output*/
orientation=portrait /*sets the page orientation to either landscape or portrait - starting 9.2 we may change orientation within a document*/
topmargin = '.5in' bottommargin = '.5in' leftmargin = '.5in' rightmargin = '.5in'
/*output |before and after| information to RTF for before recoding variables
- this way I can review as a document or in SAS OUTPUT window*/
ODS RTF FILE= 'h:\test Feb24.rtf'
startpage=no keepn contents=yes Style=theme;
ods tagsets.excelxp options
(contents = 'yes' /*creates a sheet for table of contents*/
sheet_name = 'contents' /*names the content sheet*/
EMBEDDED_FOOTNOTES = 'Feb 24, 2011' /*puts the quoted text - in this case date created - as a footnote*/
SHEET_INTERVAL = 'none' /*this controls where each work sheek is created - default is table*/
GRIDLINES = 'on'
Generally, when I run into that failure to open a workbook, it is for one of these reasons:
1) I need to update TAGSETS.EXCELXP
2) I have specified some combination of suboptions that generate invalid XML.
So I tried a simplified version of your code (with SASHELP.CLASS) and made a few changes/corrections/simplifications -- but I did not get a Workbook error and the XML file opened correctly in Excel -- I am using Excel 2010, SAS 9.2 and v 1.94 of TAGSETS.EXCELXP -- so you'll have to try the same code and see what you get with your versions of SAS, Excel and TAGSETS.EXCELXP.
(Or you may have to work with Tech Support, as they can test code on older versions of SAS.)
In my version of TAGSETS.EXCELXP, PRINT_FOOTER suboption takes a string and EMBEDDED_FOOTNOTES is only a YES/NO suboption. CONTENTS= with SHEET_INTERVAL='NONE' didn't make sense to me -- SHEET_INTERVAL='NONE' tells ODS to make one big table for ALL your PROC FREQ individual tables -- so essentially, the CONTENTS= will probably point to that one big table.
At any rate, with this simplifed code (I took out the ODS RTF step too), I do get output in Excel -- note that the CONTENTS= sheet is already named Contents and the SHEET_NAME='wombat' causes the separate sheets to be named wombat, wombat 2, wombat 3, etc -- so I don't see a name for sheet_name='contents'.
If you go into Print Preview mode, you will see the difference in placement of the SAS footnote and the text string in PRINT_FOOTERS suboption. Once you have working output, then I would go back and change 1 thing at a time -- change the style or change 1 and only 1 suboption, until you hit the combination that breaks. Then, if you think the combination of options should work, you'll have to open a track with Tech Support to see if they can 1) replicate your issue and 2) whether they agree that it's a bug or whether the XML creation is working as designed or 3) whether you are trying some combination of options that results in invalid XML.
data work.usethis ;
Are you doing this as a stored process or using SAS/IntrNet??? If the issue is intermittent, then I think your best bet for a solution is to work with Tech Support to figure out what is intermittently causing the Dispatcher program or stored process to fail.