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

st: RE: Opening a second log when one is already open

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Opening a second log when one is already open
Date   Tue, 7 Oct 2003 19:05:30 +0100

Renzo Comolli
> I usually log the entire do file execution and I would like 
> to keep it like that.
> Moreover, I would like to open a second log within the 
> first log in order to
> log only little pieces of the execution, usually tables or 
> regression output
> with -reformat- (the best command, for some purposes). 
> This is only for time saving purposes. So far I logged all and then
> cut-paste pieces. But this could potentially amount to huge 
> time savings for
> me.
> I of course used -findit- and read the manual and even 
> reverse-engineered
> part of the (for me complicated) -outreg- to see whether I 
> could do this
> somehow better, but to no avail.

This is an interesting problem. I'll consider 
only _one_ level of nesting. That is, you want something 

. log using A 


. <also log using B1> 
. <close log using B1> 


. <also log using B2> 
. <close log using B2> 


. log close A 

I have three lines of thought on tackling 

0. Using both -log- and -cmdlog-. This 
would, I think, need two passes 
to produce parent log and child(ren) log(s). 

1. Set up your own conventions using comment 

* start filename.ext 
* end filename.ext 

and write something to look for such blocks 
within a log file and write them out to filename.ext. 
This is possible with scripting languages, 
better text editors, or with Stata itself. 

2. One suggestion that has been made previously 
(Boston, some breakfast, March 2003) is a -to- command, which 
might work like this 

. to <filename>, <to_options> : <command> 


to regress.log : regress hausman heckman1 strangeman heckman2 

would send the results of -regress hausman heckman1 strangeman 
heckman2- to the file regress.log -- irrespective 
of what -log- or -cmdlog- was in force. 

Some obvious possibilities are 

. to <filename>, append : <whatever> 

. to <filename>, replace : <whatever> 

To repeat, this was just a _suggestion_. It could 
be done crudely with an ado, but subtly would I 
think be a job for Stata Corp. But would 
anybody use it if it existed? 

[email protected] 

*   For searches and help try:

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