Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -xmlsave- to Excel (for Mac?)


From   kturner@stata.com (Kevin Turner)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -xmlsave- to Excel (for Mac?)
Date   Wed, 05 Apr 2006 15:02:23 -0500

On Apr 5, 2006, at 11:04 AM, clinton.thompson@summitllc.us wrote:
> I am using S/E 9.1 for Macintosh.  Perhaps I am missing something  
> woefully obvious, but shouldn't the use of -xmlsave- create a file  
> that is readable by Excel??  As I understand the help file, the  
> following syntax ought to create a file (generic spreadsheet) that  
> Excel can read:
>
> xmlsave gofigure, doc(excel)
>
> After gofigure.xml is created, the file can be opened w/ a text  
> editor, albeit not w/ MS Excel.  Could this be because I'm using a  
> Mac??

There appears to be a bug in the Mac version of Microsoft Excel, in that it
doesn't truly parse the XML spec:

	http://www.w3.org/TR/REC-xml/

If you open the XML file produced by Stata you will see the first line looks
like:

	<?xml version='1.0' encoding='US-ASCII' standalone='yes'?>

If you (using any text editor) change all the single quotes on this line to
double quotes, Excel for Mac will properly parse the document. The modified 
line would look like:

	<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>

The use of single versus double quotes should not matter based on the XML spec 
(http://www.w3.org/TR/REC-xml/#NT-XMLDecl) that defines the xml tag in the
prolog of the document.

So, while it is perfectly legal to use single quotes, the next exectable update
of Stata will have a change to -xmlsave- to use double quotes for the sake of
allowing the Mac Excel parser to read the document.

Hope this clears up some of the confusion.

--Kevin 
kturner@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index