As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips Talk:Automatically opening Excel workbooks created by the ExcelXP tagset

From sasCommunity
Jump to: navigation, search

Good tip. Instead of:

options noxwait;
x 'start c:\temp\class.xml';

I've used:

dm "wbrowse 'c:\temp\class.xml'";

and it seems to also work. Are there any pros/cons of these two alternatives? Perhaps this could be addressed in a read more page. --Don Henderson 09:13, 9 March 2009 (EDT)

X is an OS-independent statement and WBROWSE is an OS-dependent command, so I would guess that they can be used in slightly different places. The X statement requires less typing, and the documentation is easier to find (only the OpenVMS version of WBROWSE is in the 9.1.3 online index, for example, even though all the OS-specific versions are found on the Search tab). --Jack Hamilton 10:46, 9 March 2009 (EDT)

Because we are dealing with Windows, I don't think platform in/dependence is an issue against WBROWSE. One would think that using the X statement requires less overhead than WBROWSE, because WBROWSE passes the file to the default Web browser, which in turn passes the file to the handler program. On my system WBROWSE was much faster than the X statement. There might be some tuning options, besides NOXWAIT, that need to be specified.

In any case, all of this assumes the following, which probably should be stated in the article:

  1. Excel is installed on the same machine as SAS, which is not always the case.
  2. The default application string for the OPEN action of the XML file extension has not been changed since Excel was installed.

There is at least one other assumption, but I think it can be safely ignored for this tip.

I tested this with Excel 2003 and would expect it to work with Excel 2007, but someone should probably verify that.

--Vince.DelGobbo 20:35, 9 March 2009 (EDT)

Tip seems ok to post. A little long. Once it goes up, perhaps others can do some refinement about working on other environments, but since Excel is a Windows application, seems fine to restrict the tip to Windows. --Statprof 08:14, 12 March 2009 (EDT)

I like the tip. I did not know about 'start' in the windows environment. I tested this on MSOffice 2007 (XP Pro) and instead of Excel, IE7 started and displayed the XML code. Changing the extension to .XLS got Excel to open, there was, however a conflict with the filetype (which is, of course, really XML). When forced to open the XML, Excel did display the table. --Art Carpenter 15:03, 12 March 2009 (EDT)


Can you examine your XML file using a text editor to see if it contains this string near the top of the file?

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

If it does not, it means you are using an old version of the tagset, and need to upgrade.
--Vince.DelGobbo 15:38, 12 March 2009 (EDT)

If you want to start a file with a particular application, you can specify the program name in the START command. For example, if you have two versions of Office installed, you could open the XML file with the non-default version. The syntax depends on the program you want to use. --JackHamilton 16:18, 19 March 2009 (UTC)

Vince - I search for that string and did not find it in the XML. START did start excel when I specified the application. Perhaps that makes the following a bit more robust.

options noxwait;
x 'start excel c:\temp\class.xml'; 

--Art Carpenter 23:25, 5 April 2009 (UTC)

good tip --Nancy 19:54, 6 April 2009 (UTC)


People should not be using that old of a version of the tagset -- they will regret it ;-)

The START command works on file associations, and is an independent issue of having the PROGID in the XML file.

--Vince.DelGobbo 14:52, 7 April 2009 (UTC)

Automatically opening ExcelXP output

I have found this to work for me. The nice thing is that I don't have to remember or repeat the .xml file name for use in a WINEXEC, X, or %SYSEXEC statement.

Change Tools/Options/Preferences/Results to Check View Results as they are generated View results using: Internet Explorer

In my code I have

ods tagsets.ExcelXP file="myDestination.xml";
ods results off;

... sas code here ...

ods results on;
ods tagsets.ExcelXP close;

When the View results setting is "Internal Browser" you will see an XML dump. I've heard that will be fixed 9.4+.