I have tried what I have found on the support forums but nothing seems to work. I have tried to use the XLSX and XML extension on the ENAME portion of the code below and i cannot even open the file. Below is the only way I have managed to export and email the report and is able to open but it pops up the warning. I would like it not to have such a warning.
My SAS version is : 8.2 (8.2.0.1201) (32-bit)
DATA _NULL_;
ENAME_DT = PUT(DATE(),DATE9.);
ENAME = STRIP(("Weekly_Report_" ||ENAME_DT||".xls"));
CALL SYMPUT("ENAME", ENAME);
RUN;
%LET OUTPUT_PATH = /data/bi/data/inbox/;
ODS LISTING CLOSE;
ods tagsets.ExcelXP style=sasweb path= "&OUTPUT_PATH" file= "&ENAME" Style=Printer;
ods tagsets.ExcelXP options(sheet_interval="none" sheet_name='Weekly Summary Report' AUTOFIT_HEIGHT="yes" absolute_column_width='10,20,5,5,5,5,5,5,5,5,7,7,7,7,7');
%report_page1(BO_WEEKLY_RESULTS);
ods tagsets.ExcelXP options(sheet_interval="none" sheet_name='Weekly AHT Report' AUTOFIT_HEIGHT="yes" absolute_column_width='10,39,5,5,5,5,5,5,5,5,7,7,7,7,7');
%report_page2(BO_AHT_WEEK_RESULTS);
ods tagsets.ExcelXP options(sheet_interval="none" sheet_name='Weekly Due Report' AUTOFIT_HEIGHT="yes" absolute_column_width='10,39,5,5,5,5,5,5,5,5,7,7,7,7,7');
%report_page3(BO_DUE_WEEK_RESULTS);
ods tagsets.ExcelXP close;
/*%exec(step=Output the invalid eDM file, parm=&OUTPUT_PATH./&ENAME..csv);*/
filename mymail email to=('nam@email.com')
subject= "Weekly Report."
attach=("&OUTPUT_PATH./&ENAME" content_type="application/xls");
data _null_;
file mymail;
put 'Hello:';
put ' ';
put "Attached is the Weekly Report";
put ' ';
put 'If you encounter any problems with the file please let me know. ';
PUT ' ';
PUT ' ';
put 'Thank You,';
put ' ';
run;
Hi,
What does the warning message say?
And also you are not using .xml extension in ENAME. I believe tagstets.excelxp is not compatible with.xls extension which was used in the program.
"The File format and extension of '<filename>.xls' don't match..."
I have tried the XML extension in ENAME but then I cannot open the file.
@Jyuen204 wrote:
"The File format and extension of '<filename>.xls' don't match..."
I have tried the XML extension in ENAME but then I cannot open the file.
That likely means that you have to associate the XML extension with program you want to read the file. If, given the name you are using, the program is Excel, they stopped shipping it with an association to XML for some reason. But you should be able to use Open With and tell your system to use Excel.
And the file type doesn't match. As Tagsets.Excelxp makes a microsoft flavour of XML.
We use the Excel XP tagset in SAS and write the files with an XML extension. When you right click on the file in Windows Explorer and choose "Open With" is the "Office XML Handler" one of the options? That's what you need to choose to open the file with Excel.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.