Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: About log file

From   Joseph Coveney <>
To   Statalist <>
Subject   Re: st: About log file
Date   Sat, 08 May 2004 16:33:48 +0900

Maoyong Fan wrote:

> Is there any way to just put my regression results instead of every step of 
> my program into the log file?  That will make it easier to check results.

Try putting the regression command in a brief, simple "wrapper" program, along 
with the -log using- and -log close- commands.  

The log file will only have the regression results--it won't even contain the 
regression command, itself.  

I recommend adding a brief -display- command just before the regression command 
to provide identifying information in the log file.  You can even -display- the 
regression command (in quotes) in order to identify it.

The approach is illustrated in the do-file below.  You can also use -log off- / 
-log on- in this approach with the necessary modifications to the program(s).

Joseph Coveney


set more off
sysuse auto
* data-manipulation steps of your program 
* that you don't want to log go here
program define logem
    version 8.2
    capture log close
    quietly log using my_log 
    display as text "This is the title of my regression (to identify it)"
    regress `1' `2'
    quietly log close
logem headroom gear_ratio


*   For searches and help try:

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