I've had an interest in graphical logs for some time and would like to
comment on a couple of points raised in this thread.
Ashim has referenced an old thread above where I had posted that I had
created a -gr2log- of my own and a -grlog2html- modification of Baum,
Cox & Rising's -log2html- . I had not made them available previously
because the routines were still buggy and would trip on unbalanced
quotes arising in continuation lines. (Indeed, the whole continuation
lines issue can be difficult.) However, if anyone is interested in
testing -gr2log- and -grlog2html-, I would be happy to provide copies
to persons who contact me privately (help files are part of the
package). Perhaps additional testing and suggestions can help get
these ready for distribution in the SSC Archive.
Basically -gr2log- is a graphing command wrapper that exports a *.png
file of each graph produced and -grlog2html- incorporates the graphs
into a HTML log immediately following the command that created it.
When it works - it works a charm.
Regarding problems with -log2html- mentioned by Neil Shephard, I don't
know if this is related but I have found that it can trip on input
lines like the following:
{com}. local service "`"Radiotherapy Treatment"' `"Referral to Medical
Oncology"' `"Referral to Radiation Oncology"'"
from a program trace of -log2html-:
- file write `ho' `"`macval(line)'"' _n
= file write __000001 `"<span class=input>. local service
"`"Radiotherapy Treatment"' `"
> Referral to Medical Oncology"' `"Referral </span>"' _n
invalid syntax
This problem goes away if I -set linesize- to a sufficiently high
value to avoid continuation lines which create unbalanced quotes. If
the do file does not have compound and nested quotes I haven't had
problems with -log2html-
I'm currently seeing if I can intercept problems in -grlog2html- using
the replacement capabilities of -filefilter- to create HTML entities
out of all the quotes prior to any further processing, a strategy that
would work in -log2html- as well.
The following is a possible alteration starting at line 70 of
-log2html- incorporating -filefilter- quote fixes.
(remember to copy under a new name any official or user-supplied ado
you wish to modify)
=========================
// filenames and handles
tempname hi ho
tempfile LQRQDQ RQDQ DQ htmlfile
local origfile `smclfile'
if (!index(lower("`origfile'"),".smcl")) {
local origfile "`origfile'.smcl"
}
local smclfile : subinstr local smclfile ".smcl" ""
local smclfile : subinstr local smclfile ".SMCL" ""
local smclfile : subinstr local smclfile `"""' "", all /* '"' (for
fooling emacs) */
local smclfile : subinstr local smclfile "`" "", all
local smclfile : subinstr local smclfile "'" "", all
local outfile `"`smclfile'.html"'
if "`linesize'" != "" local ll "ll(`linesize')"
qui log html `"`origfile'"' `"`LQRQDQ'"', `replace' yebf whbf `ll'
// try filefilter to handle quote problems
filefilter `"`LQRQDQ'"' `"`RQDQ'"', from(\LQ) to("‘") // left quotes fixed
filefilter `"`RQDQ'"' `"`DQ'"', from(\RQ) to("’") // right quotes fixed
filefilter `"`DQ'"' `"`htmlfile'"', from(\Q) to(""") // double
quotes fixed
==========================
I believe graphical logs have their place in data exploration and look
forward to the day when we might see such capabilities in SMCL. Until
then, -gr2log- and -grlog2html may provide interested users with
workarounds.
David Elliott, MD, MSc
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/