BookmarkSubscribeRSS Feed
Jyuen204
Obsidian | Level 7

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;

7 REPLIES 7
A_Kh
Lapis Lazuli | Level 10

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. 

Jyuen204
Obsidian | Level 7

"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.

ballardw
Super User

@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.

Jyuen204
Obsidian | Level 7
Yeah i have xml associated with excel in Windows but that doesnt seem to matter as it still produces and error and doesnt open up in excel.
Reeza
Super User
Does it open if you open the file from within Excel (In Excel, Open File, select the XML)? If not, then the file is problematic for some reason. Do you have the most up to date tagsets?

ODS tagsets is a bit outdated. If you can switch to ODS EXCEL it would be useful for sure.
Reeza
Super User
From the log what is your tagset version?
SASKiwi
PROC Star

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 424 views
  • 0 likes
  • 5 in conversation