Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Writing graphs to the log file


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Writing graphs to the log file
Date   Tue, 18 Nov 2008 15:39:08 +0100

Line for the server...

But change is under way: Note  Bill Rising`s talk at the Milan UGM 2008
(http://www.stata.com/meeting/italy08/abstracts.html)

The fact that -ssc hot, n(4)- throws up nothing but "translation" packages
is certainly not lost on StataCorp...


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of David Airey
Sent: Tuesday, November 18, 2008 3:21 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Writing graphs to the log file

I think one disappointment with Stata is no package like Sweave for R  
or SASweave for SAS for weaving together publication quality text,  
code, output, and figures into one file, more or less seamlessly. HTML  
output is also good thing. I have used and appreciated log2html.  
Improvements would be great. ATS also had an HTML package that worked  
figures in, but I think it stopped working. It would be nice to have  
HTML and LaTeX output, but HTML at minimum.

-Dave

On Nov 18, 2008, at 5:32 AM, Nick Cox wrote:

> David's example I understand as indicating that -file write- cannot
> handle a line in his file. -file- is a Stata command. It's a moot  
> point
> whether that failure should be attributed to -log2html-, a user- 
> written
> command. What generic problem does it show that could or should be
> handled by pre-processing within -log2html-?
>
> As one of the authors of -log2html- -- and without speaking for the
> others, each of whom is less shy than I am -- I'll declare a lack of
> interest in developing -log2html- further. Some work produced what
> remains to me a useful program for translating SMCL to HTML. But
> tackling the very understandable problem of handling HTML within  
> files,
> or of embedding more HTML within such files, is to me a Sisyphean task
> that does not attract.
>
> More positively, David is running with the baton here and I'm shouting
> encouragement from the stands.
>
> Nick
> n.j.cox@durham.ac.uk
>
> David Elliott
>
> 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("&#145;") //
> left quotes fixed
> 	filefilter `"`RQDQ'"' `"`DQ'"', from(\RQ) to("&#146;") // right
> quotes fixed
> 	filefilter `"`DQ'"' `"`htmlfile'"', from(\Q) to("&#34;")  //
> 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.
>
> *
> *   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/

*
*   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/

*
*   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/



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