Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: executing commands on exit


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: executing commands on exit
Date   Tue, 13 Sep 2011 14:40:14 +0100

One possibility (if you want to put your Stata commands in a do-file, which is usually a good idea) is to use the -dolog- package, downloadable from SSC(in its Stata 12 version) or from my website at

http://www.imperial.ac.uk/nhli/r.newson/

(in earlier Stata versions). Once -dolog- is installed, you can type

dolog mydofile

and Stata will execute the do-file -mydofile.do- and output the log to -mydofile.log-.

The alternative (if you want to log your whole Stata session to 1 log file) is to do as you suggest, but to remember to type

log close

just before exit.

I hope this helps.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

On 13/09/2011 13:54, A. Berâ wrote:
Dear Stata Users,

     How can I make Stata open a log file (with a name say temp)
automatically when it starts and close it automatically when I exit
Stata?

I know I can put

.log using temp.log, name(temp)

in profile.do, but I don't know how to close it automatically when I
exit Stata. Thanks.

--
abdullah berâ

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index