help for log2htmlSSC distribution 8 June 2006

Translate a SMCL log file into HTML

log2html
smclfile
[,
replace
erase
title(string)
linesize(#)

percentsize(integer)
bold

scheme(string)
css(string)

input(string)
result(string)
error(string)
text(string)
bg(string)
]

Description

log2html translates Stata log files or other
files in SMCL to HTML.

Remarks

log2html is primarily for use after log; see log.

log2html makes use of an undocumented command in Stata version 7
up, log html, which generates HTML files from SMCL (e.g. log) files.
SMCL, the Stata Markup and Control Language smcl, is the default log
file format introduced with version 7, and contains markup (similar to HTML)
around elements of the log file. To use log2html on log files, you must
first generate the default SMCL log file, not a text log file, with the file
extension .smcl. Thus if you have set logtype text to prevent the
generation of SMCL log files, you must either turn it off or explicitly state
that a SMCL log file is to be produced, as by log using my.smcl.

log2html requires only the base name of a logfile:
e.g. my, if the logfile is named my.smcl. The name of the HTML file
produced will be this base name with .html appended, e.g. my.html.

log2html requires Stata version 8 at least.

loghtml produces a complete HTML page (i.e. with <HTML> and
<BODY> tags). By default, the page will have a white background; input lines
(those resulting from user input) are rendered in RGB color "CC6600" (a shade
of brown); and highlighted result-window lines are rendered in RGB color
"000099" (a shade of blue). The options permit other choices for these three
colors. For best results, one of the 216 "web safe" colors that display
properly in web browsers on all computers in 256-color mode should be used.
Also note that some combinations of colors are not workable; e.g. a black
("000000") background will cause all normally-rendered text to disappear.

Colors are specified as hexadecimal RGB colors ranging from 000000
(black) to FFFFFF (white), where FF0000 is red, 00FF00 is green, and 0000FF is
blue. It is best to use web-safe colors, where both digits of each color pair
match and are divisible by 3 (i.e. 00 33 66 99 CC or FF).

Those wanting to include the CSS classes used by log2html should
make an HTML file with the CSS option, and then look at the resulting
page in a text editor. It will give more insight than any explanation here
could give.

Options

replace specifies that if the HTML file exists, it is to be
replaced.

erase specifies that the SMCL log file is to be erased (deleted)
after processing.

title() specifies a string to be placed in the <TITLE> of the
HTML page, and on the first line of the body of the page, using a <H2>
heading.

linesize() specifies a maximum line size for the result,
i.e. the width in characters of rendered HTML lines. The argument
must be between 40 and 255 inclusive. Default is the current linesize.

The remaining options pertain to setting how the HTML page will appear
when rendered in a browser.

percentsize() specifies the scaling of the font to be used on
the resulting HTML page as a percentage of the default. (The
actual size is not specified, since it is typically specified by
the person using the browser, not the person sharing the
information.) This affects all text on the page.

bold specifies that input lines (those resulting from
user input), results from Stata, and error numbers be displayed as
bold text.

scheme() is the simplest way to change the colors of the
resulting web page. The allowable schemes are

black, white, or blue, which correspond closely
to the colors of Stata's color schemes for the results window.

yellow, which makes an easy-on-the-eyes page with
a faint yellow background.

input(), result(), text(), and error() can be
used independently to set the foreground color of the text which corresponds to
user input, Stata results, plain text output, and error numbers.

bg() specifies the color of the background of the
page. For convenience, this can be given as "grey" or "gray".

css() specifies the cascading style sheet for the web
page. This is an advanced option for people who use CSS for
standardizing the appearance of their web sites. If you do not know
what CSS means, there is no need to worry: if this option is
omitted, log2html will put the proper information into the
HTML file it creates.

Examples

. log using autostudy, replace

. use auto

. desc

. summ

. regress price mpg rep78

. log close

. log2html autostudy, replace

. log2html autostudy, replace ti(Automobile study)

. log2html autostudy, replace ti(Automobile study) scheme(black)

. log2html autostudy, replace in(ff3300) res(003333) bg(grey)

. log2html autostudy, replace ti(Automobile study) css("./mystyles.css")

References

Priester, Gary W. 2000. All you need to know about web safe colors.

http://www.webdevelopersjournal.com/articles/websafe1/websafe_colors.html

Richmond, Alan. Introduction to style sheets.

http://www.wdvl.com/Authoring/Style/Sheets/Tutorial.html

Acknowledgements

Ken Higbee helped with the documentation
of log html and made suggestions for improvement of this routine.
Renzo Comolli drew our attention to problems arising with long lines
and quoted filenames. Friedrich Huebler also raised the issue of
line size and Alan Riley and Joseph Coveney showed how to tackle it.

Authors

Christopher F Baum, Boston College, USA

baum@bc.edu

Nicholas J. Cox, Durham University, UK

n.j.cox@durham.ac.uk

Bill Rising, Bellarmine University, USA

wrising@bellarmine.edu

Also see

Manual: [R] log, [P] smcl

On-line: help for log, smcl