SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
yuwda011
Calcite | Level 5

Hi,

 

I write a program using mainframe SAS to send an email with excel spread sheet attachment.  the following are the information for the file.

In window 10 this xml file is handled by office XML handler.  The same file was working before and it was open by excel. 

But in window 10 office XML handler fails to recognize it is an excel file and it is opened in IE instead Excel.

I search microsoft web site and it said the header does not have right information indicating this is an excel file.

is there any fix for this issue in SAS?

 

Thanks, David 

    

 

<?xml version="1.0"?>

<?mso-application progid="Excel.Sheet"?>

-<Workbook xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="urn:schemas-microsoft-com:office:spreadsheet">


-<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">

<Version>16.00</Version>

</DocumentProperties>


-<CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">

<TitusGUID dt:dt="string">ecbb8e5d-4e9d-4d53-9fc7-665b99c47949</TitusGUID>

<Classification dt:dt="string">Unclassified</Classification>

</CustomDocumentProperties>


-<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">

<AllowPNG/>

</OfficeDocumentSettings>

5 REPLIES 5
ballardw
Super User

This is a Windows association issue, not SAS related.

 

Had the same thing happen when our office moved to Office 365 where Excel no longer even recognized it was allowed to open XML files. Finding the correct program to tell Office that it should recognize XML is a pain but you will need to do a right click on an XML file and go through the Open With menu to add XML to excel. Be prepared to have to browse through a lot of levels of windows programs/office settings to find the Excel.exe.

yuwda011
Calcite | Level 5

Hi,

 

I think it is bug in SAS code. SAS failed to provide valid header to tell office XML handler this XML file is EXCEL file.

Please have your developer to work with Microsoft to resolve ths issue.

There is no need  to associate XML file to EXCEL if there is valid file header.   

 

Thanks, David 

Tom
Super User Tom
Super User

So I told Excel to save a spreadsheet as an XML spreadsheet document.

Here is what the header looks like. How is that different from what SAS is creating?

660   %let fname=C:\Users\abernathyt\Documents\excel_file.xml;
661   data _null_;
662    infile "&fname" ;
663    input;
664    put _infile_;
665   run;

NOTE: The infile "...\excel_file.xml" is:
      Filename=...\excel_file.xml,
      RECFM=V,LRECL=32767,File Size (bytes)=3271,
      Last Modified=01Apr2021:12:19:02,
      Create Time=01Apr2021:12:18:58

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">

 

UPDATE: When I clicked on the file I created with Excel in Windows Explorer it was opened in the browser and showed the text of the XML.  It did NOT open in Excel.  So the change is from Windows and/or Excel and not from anything the SAS code is or isn't doing.

yuwda011
Calcite | Level 5

Hi Tom,

 

Please recreate the issue in house. then talk with your developer if it can be fixed.

From the user's point view, this code is working before and now failed after office 360 upgrade. 

I will treat as bug.

 

Thanks, David    

 

 

Kurt_Bremser
Super User

@yuwda011 wrote:

Hi Tom,

 

 failed after office 360 upgrade. 

 


So it is a MS Office/Windows issue. Never be surprised when a Microsoft "upgrade" (which is a Redmond euphemism for "throwing a beta test on unsuspecting customers", IMHO) breaks something that worked perfectly before.

 

Save the .xml to your disk and do the right-click/"Open with", then re-associate it with Excel as the primary handler.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 6459 views
  • 0 likes
  • 4 in conversation