Statalist The Stata Listserver

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

Re: st: Output management

From   Ian Watson <>
Subject   Re: st: Output management
Date   Sat, 10 Feb 2007 11:23:14 -0800


If you're stuck with using MS-Office, then my suggestion is irrelevant.
But if you're able to move to LaTeX, you might be interested.

My package -tabout- (ssc desc tabout) encourages the batch production of
large numbers of descriptive tables, whose output can be embedded into
reports at an early stage in the rewriting. Subsequent changes to the
data, or to contents of the preferred layout of the table, can be made
at any time and then (through a do file), the whole report can be
updated. (Annual reports of standardised results also spring to mind.)

A little while back I contemplated writing a graphics version of
-tabout- so that Stata's graphs could be dealt with in the same way. But
I baulked at the amount of work involved. Instead, I wrote a short
program which "read" the table files (ie. the plain text files which
contained the descriptive table data) and fed these into various Stata
graph commands. The output of these graphs commands (as EPS files, or
easily converted into PDF files) were also embedded into the report.

So, in summary, the work flow was something like:
a) modify the data / or choice of table contents/layout
b) run the do file to update all the report tables
c) run the do file to extract the graph input from the table files and
feed this to Stata's graphics engine via a do file to produce EPS (or
PDF) text files
d) recompile the report (in LaTeX) to produce an updated report in which
tables and graphs all correspond to the latest data

Obviously steps b) to d) can themselves be put in a do file and my
recollection is that the whole process used to take less than 30
seconds. Stata can be made to compile LaTeX documents quite easily
through its -shell- command, and it can even launch your PDF viewer to
see the final report without ever leaving the Stata environment.

If any of this interests you, let me know and I'll send you the code for
creating graphs from tabout's textfile output, as well as the do files
which facilitate the batch sequence outlined in steps b) to d) above.

Ian wrote:
We are a mixed-brand shop using Stata and SAS. (I greatly prefer Stata but we hire "classically" trained folks too.) We face a challenge in generating batches of reports that are visually identical but provide estimates tailored to specific end-users, for example, a standardized "profile" of analytic results by county. From Stata, I've done the job semi-manually by transferring output to an Excel spreadsheet which is programmed to generate the desired graph or chart, then cutting and pasting charts/graphs into MS-Word. It's clumsy, with potential for human error, and Word doesn't handle pages well when many graphic objects are embedded. I haven't tried programming Stata to generate graphics directly because I think it would take much programming to yield limited options compared to Excel. But Excel can't analyze in the ways we need (e.g., complex-sample survey data analysis).

SAS sells a fancy package with a "business intelligence" analytic engine and an MS-Office add-in. I haven't investigated but assume our small academic group can't afford it. Can someone suggest either a better Stata-based method than my cut-and-paste approach or a Stata-related software solution?

Arnold H. Levinson, Ph.D.
Assistant Professor of Preventive Medicine & Biometrics
Director, Tobacco Program Evaluation Group (TPEG)
University of Colorado / AMC Cancer Research Center
1600 Pierce Street
Lakewood CO 80214

*   For searches and help try:

*   For searches and help try:

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