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/