Statalist The Stata Listserver

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

Re: st: dynamic report generation

From   "David Elliott" <>
Subject   Re: st: dynamic report generation
Date   Mon, 30 Oct 2006 12:56:51 -0400

I have had some experience with this in a minor way.  I have developed
routines for reporting waiting times for medical diagnostic and
therapeutic procedures that are reported on our website: .  It has a combination
of fixed text and tables that are updated quarterly.  In the
beginning, these tables were hand coded, or created from spreadsheet
inserts of Stata results.  Since I had already written a custom ado to
do the analysis, I added a html option that outputs the tables in
html*.  This has reduced the time to update from weeks to hours as the
tables can be uploaded to the website and incorporated into the pages
using <!include> statements.  An option I suggested, but has not been
implemented, is the ability to write FTP scripts from within Stata and
then execute them with !ftp -i -s:scriptname to automatically update a

I have also implemented something which is a bit like stored
procedures in database management systems.  We have a couple dozen
categories we are monitoring, but many of them require special
handling in terms of measures, ifs, and have custom titles and such.
The way this has been implemented is with a dta file containing the
procedures, measures, ifcmds, titles, special groupings, dates and
other parameters each as separate string variables.  I created an ado
to read this file into a series of macro arrays and access the
contents within a forvalues loop using `"`variablename'_`i'"'.  From
these parameters we can create on-the-fly groups and labels and titles
which creates highly customized output within a single loop.  The
updating of the run parameters can be done in the data file by someone
without any real knowledge of Stata or statistics - they basically can
work in English.

Any time you find yourself doing a large amount of block and copy (of
either program blocks or output) on a regular basis, especially if you
are in a production environment requiring interval reporting, it
really pays to step back and look at the workflow and opportunities
for automation.


* it is not difficult to get Stata to output html tables but remember
to replace all the html quotes " with _char(34) so they do not
interfere with Stata's quotes.
*   For searches and help try:

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