Statalist The Stata Listserver


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

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


From   Phil Schumm <pschumm@uchicago.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -xmlsave- to Excel (for Mac?)
Date   Wed, 5 Apr 2006 13:13:11 -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??
On Apr 5, 2006, at 11:25 AM, Ronnie Babigumira wrote:
Hmm... works for me. Actually simply double clicking the file opened it in excel (with text files I would have to open it from within excel).

Windows xp pro, MS Office 2003, stata 9.1

I know very little about Excel, and even less (nothing, actually) about it's xml file format. But I too see a problem (I don't know if it's the same one reported by Clint). Specifically, if I do the following:


. sysuse auto
(1978 Automobile Data)

. xmlsave auto.xml, doc(excel)
file auto.xml saved


and then try to open auto.xml in Excel, I get what Excel calls a "Strict Parse Error" resulting in an inability to read the file. Note that we're not talking about what happens when you double-click on the file in the Finder (this depends on how your machine is configured); I launched Excel, and from within Excel chose File -> Open. My particulars are: Stata 9.1 (20 Jan 2006) for OS X (10.4.6), and Excel 2004 for Mac, Version 11.2 (050714).

If this is what you are seeing, I'd suggest one of the following alternatives: -outsheet-, Stat/Transfer, or ODBC.



Note that the text file for gofigure.xml does not present the file in what i would consider the "expected" format, i.e. variable names on the top line followed by the data...

XML is not a flat format (like CSV), but rather a hierarchical one. Thus, the structure will necessarily be different. Moreover, unless you open the file in an XML editor, it's going to be difficult to read (especially if you're not used to it).


-- Phil

*
* 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