Skip Navigation Links
Link to the last RSS article here: Using R with Excel - A (D)COM Server for the Windows Platform (Part I) - Ed.
Delivering Results to the End User: Three Stata 8.0 Examples, Part 2
By Patrick McLeod, ACS Research Consultant
In Part 1 of this article we had a brief introduction to two methods for delivering results to the end user in organized, intelligible form using Stata 8: -estimates table- and –listtex-. Part 2 will provide code and examples for the user to generate their own example files in Stata 8 and LaTeX using –latab-, –listtex- and –outtex-. It is worth noting for non-LaTeX users of Stata that the –listtex- command allows you to produce tables in HTML in addition to LaTeX format.
Before You Begin: Errata
If you are using Stata from a dedicated network connection (i.e. from an office computer at your UNT office or from a computer at home with a DSL, cable, or wireless internet connection), then you will probably need to find at least one of these files. Never fear! Stata has a painless internet search and retrieval function on computers that are connected to the internet (if you are using dialup access, this may take some time). For example, if you need to retrieve and install the –listtex- package for this example, you would simply type the following in the Stata Command box:
This should return a new Stata Viewer window with web-enabled links to different occurrences of the command listtex from both Stata’s official help files and from the extensive body of Stata’s web resources. Here’s an example screenshot:
By clicking on any of the blue links (web-enabled links), you can access articles in the Stata Viewer or by clicking on a link to an issue of the Stata Technical Bulletin (links in the format stb00000) or the Stata Journal (links in the format sj0000), you will be given the opportunity to install user-written files with a simple click of your mouse. The third link down under “Web Resources from Stata and other users” is the –listtex- link I would recommend. Click on it with your mouse and Stata will do the rest: Installation, verification, and deletion of the extra files. And just like that we’re ready to use –listtex-! Go ahead and try a –findit- on –latab- and –outtex- while you are at this stage and install these .do files.
The Base .do File
Cut and paste the following syntax into your Stata .do file editor or into your editor of choice (Emacs, WinEDT, etc.):
This file uses some test score data from UCLA’s excellent Academic Technology Services center (http://www.ats.ucla.edu) to illustrate three potential ways of displaying information about data, descriptives, and estimation procedures.
The –listtex- command issued in our example file writes out a list of all the scores for the variables read, write, math, and science to the log file in LaTeX format. You can then cut and paste the LaTeX formatted information from your log file into your LaTeX file. In this particular example, we’re listing all the values for the variables read, write, math, and science in the data set with a title line for the table. For more information on –listtex- options, type –help listtex- in the Stata Command box.
The –latab- command allows the user to generate summary statistics and present these statistics in a LaTeX formatted table. In the example, -latabstat- is called to show score means for math, read, and write by SES categories generated from the initial –tabstat- command. This output can be cut-and-pasted from the Stata log file or directly from the Stata Results window into a LaTeX file. For more information on –latab- options, type –help latab- in the Stata Command box.
The –outtex- command typesets the results of an estimation command into LaTeX format. The level option is specified in the example that adds symbols to the output that represent the coefficients’ significance level. Of the three LaTeX results delivery commands discussed here, -outtex- has the widest array of options. It is highly recommended that the user investigate the many different options of –outtex- before writing what could be a rather long command to typeset estimation results in LaTeX.
Since creating tables in LaTeX can consume an amount of time proportional to the number of rows, columns, and elements of the table, any assistance in typesetting large tables can result in less time spent typesetting and more time spent in interpretation of results. Each of the three commands discussed in this article will allow the user to spend more time on interpretation and writing and less time on presentation thanks to the formatted delivery of results provided by these commands.