Translate a SMCL log file into HTML
log2html7 smclfile [, replace title(string) input(string) result(string) bg(string) ]
Description
log2html7 is for use after log; see log. If you are using Stata 8 or later, use log2html instead.
log2html7 makes use of an undocumented command in Stata version 7, log html, which generates HTML log files from SMCL 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 log2html7, 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.
log2html7 requires only the base name of the 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.
log2html7 requires that at least the 6 December 2001 update to Stata version 7 be installed. If a message "Invalid syntax" is encountered, please ensure that query born returns a date no earlier than 06 Dec 2001.
Limitation
log2html7 cannot reliably echo names of local or global macros given on command lines in the log. This is because before being passed to the Stata command file, which does most of the hard work within log2html7, they are caught by Stata's parser and substituted with their current contents, if any. The usual result is to replace macro names with empty strings, although on occasion you may be fortunate enough to have the correct contents of a macro substituted, or unfortunate enough to have something quite different substituted, if the contents of a macro have changed since the log was created. This behavior is outside the control of the program authors, who know of no work-around in Stata 7. The limitation does not apply to log2html used in conjunction with Stata 8 or higher.
Options
replace specifies that if the HTML file exists, it is to be replaced.
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.
The remaining options pertain to color choices. By default, loghtml produces a complete HTML page (i.e. with <HTML> and <BODY> tags) with 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.
input() allows the specification of a different color for the user input lines, in standard RGB notation (three duples of two bytes, each 00-FF).
result() allows the specification of a different color for the highlighted result lines, in standard RGB notation.
bg() allows the specification of a different color for the background, in standard RGB notation. For convenience, the argument may be given as "gray" or "grey", approximating most browsers' default behavior.
Examples
. log using autostudy, replace . use auto . desc . summ . regress price mpg rep78 . log close
. log2html7 autostudy, replace
. log2html7 autostudy, replace ti("Automobile study")
. log2html7 autostudy, replace in(ff3300) res(003333) bg(grey)
Reference
Priester, Gary W. 2000. All you need to know about web safe colors. http://www.webdevelopersjournal.com/articles/websafe1/websafe_colors.htm > l
Acknowledgements
We acknowledge Ken Higbee's assistance with the documentation o > f log html and suggestions for improvement of this routine. Authors
Christopher F Baum, Boston College, USA baum@bc.edu Nicholas J. Cox, University of Durham, UK n.j.cox@durham.ac.uk
Also see
Manual: [R] log, [P] smcl On-line: help for log, smcl