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

Re: st: About log file


From   Joseph Coveney <jcoveney@bigplanet.com>
To   Statalist <statalist@hsphsun2.harvard.edu>
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

-------------------------------------------------------------------------------

clear
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)"
    display
    regress `1' `2'
    quietly log close
end
logem headroom gear_ratio
exit

--------------------------------------------------------------------------------


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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