Improving the output capabilities of Stata with Open Document Format xml - PowerPoint PPT Presentation

About This Presentation
Title:

Improving the output capabilities of Stata with Open Document Format xml

Description:

3 pages of statistical analysis. All from a study in 12 healthy volunteers. Stata's text output ... lastname White /lastname /employee /company XML code ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 21
Provided by: AdamJ59
Category:

less

Transcript and Presenter's Notes

Title: Improving the output capabilities of Stata with Open Document Format xml


1
Improving the outputcapabilities of Stata
withOpen Document Format xml
  • Adam Jacobs
  • Dianthus Medical Limited

2
Statas 3-fold capabilities
  • Statistics
  • Graphics
  • Data management

3
Statistics
4
Graphics
5
Data management
6
But there is a 4th...
7
Text output
  • A recent clinical study
  • 92 pages of raw data listings
  • 124 pages of descriptive data tabulations
  • 3 pages of statistical analysis
  • All from a study in 12 healthy volunteers

8
Statas text output
9
Problems with Statas text output
  • No pagination
  • No formatting (or limited formatting with smcl)
  • Variable labels not always shown
  • No Unicode support
  • No tables of contents
  • etc etc

10
Some examples...
11
So how did I do it?
12
Open Document Format
  • An open standard, approved by ISO
  • XML based
  • For a variety of office-type documents
  • Used by the popular open-source office suite
    OpenOffice.org
  • Here, we are just interested in word-processing
    documents

13
.odt files
  • A .odt file is the native file format of
    OpenOffice.org Writer
  • A zip file
  • Contains various files, the most important of
    which is content.xml
  • content.xml is simply a plain-text file
  • Stata is good at writing plain-text files!

14
The Stata code
  • Creates the content.xml file by writing data with
    appropriate xml tags
  • Added to other files, zipped to .odt file
  • .odt file can be opened directly with Writer

15
Some examples...
16
Basics of XML
  • ltcompany nameDianthus Medical Limitedgt
  • ltemployee rolespeakergt
  • ltfirstnamegtAdamlt/firstnamegt
  • ltlastnamegtJacobslt/lastnamegt
  • lt/employeegt
  • ltemployee roledelegategt
  • ltfirstnamegtFlavialt/firstnamegt
  • ltlastnamegtWhitelt/lastnamegt
  • lt/employeegt
  • lt/companygt

17
XML code for start of table
  • lttabletable tablestyle-name"Table42"gt
  • lttabletable-column tablestyle-name"TabC
    ol13"/gt
  • lttabletable-column tablestyle-name"TabC
    ol9"/gt
  • lttabletable-column tablestyle-name"TabC
    ol8"/gt
  • lttabletable-column tablestyle-name"TabC
    ol8"/gt

18
XML code for table cells
  • lttabletable-cell tablestyle-name"cell1211"gt
  • lttextp textstyle-name"Table_20_Contents"gt Mil
    eage (mpg)lt/textpgt
  • lt/tabletable-cellgt
  • lttabletable-cell tablestyle-name"cell1111"gt
  • lttextp textstyle-name"Table_20_Contents"gtNlt/te
    xtpgt
  • lt/tabletable-cellgt
  • lttabletable-cell tablestyle-name"cell1111"gt
  • lttextp textstyle-name "Table_20_ContentsNumer
    ic"gt
  • 52lttexts textc"3"/gtlt/textpgt
  • lt/tabletable-cellgt

19
Was this a lot of work?
  • 123 kB of code
  • 21 ado files
  • 45 Mata functions
  • And not finished yet!

20
Any questions?
Write a Comment
User Comments (0)
About PowerShow.com