Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Generating log file name (automatic daily logs)


From   "Abdel Rahmen El Lahga" <[email protected]>
To   [email protected]
Subject   Re: st: Generating log file name (automatic daily logs)
Date   Thu, 24 May 2007 18:02:40 +0200

My log file looks like:
set mem 300m
set matsize 800
log using "/home/rahmen/data/log/log $S_DATE.log" , append
cmdlog using "/home/rahmen/data/log/cmdlog $S_DATE.do" , append
adopath + /home/rahmen/data/do
adopath + /home/rahmen/data/ado
adopath + /home/rahmen/data/matafunc
set scrollbufsize 500000
macro define F4 `
macro define F5 [ ]
macro define F6 {
macro define F7 }
quietly conren s 3
quietly conren ul 1
HTH
AbelRahmen

2007/5/24, Allan Reese (Cefas) <[email protected]>:
This may be obvious or old hat, but I've been fiddling with reformatting dates to generate a daily log from Stata.
The following lines are in my profile.do

* Create daily audit trail of all commands (only allows one Stata invocation) ...
local logdate = string( d(`c(current_date)'), "%dCY-N-D" )
cmdlog using "c:\program files\stata9\logfiles\log`logdate'.txt", append
* ... and working log file of output (to rename for keeping)
capture erase c:\statalog.bak
capture copy c:\statalog.smcl c:\statalog.bak
log using c:\statalog, replace


The advantage of this format is the files stay in date order whether sorted by name or date modified.

Any simple suggestions to add 1,2 or a,b to the log filename if Stata is called more than once are invited - I guess it would require a loop, a counter, and "file open" as a test.

Allan


***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   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/


--
AbdelRahmen El Lahga
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index