The following might be helpful, although more than you asked for. The
short answer is to create a local with your full file name including the
datestamp, and use that local in the log command.
* Prepare Date/Time Stamp
local currdate = date(c(current_date),"dmy")
local stryear = string(year(`currdate'))
local strmonth = string(month(`currdate'))
if length("`strmonth'") == 1 local strmonth = "0`strmonth'"
local strday = string(day(`currdate'))
if length("`strday'") == 1 local strday = "0`strday'"
local currtime = c(current_time)
local strhour = substr("`currtime'",1,2)
local strminute = substr("`currtime'",4,2)
local strsecond = substr("`currtime'",7,2)
local DateTimeStamp =
"`stryear'`strmonth'`strday'`strhour'`strminute'`strsecond'"
display "`DateTimeStamp'"
* Log File
local LogPath "V:/ResearchProduction/Data/Stock/Auditing/Logs/"
local LogPref "Get2DaysData_"
local LogSuff ".log"
local LogFullName "`LogPath'`LogPref'`DateTimeStamp'`LogSuff'"
log using `LogFullName', replace
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Donald Spady
Sent: Tuesday, April 25, 2006 5:22 PM
To: [email protected]
Subject: st: Making a unique log file
I want to make a command log file using cmdlog, but I want it to be
unique
every time I begin Stata. Right now my command is
cmdlog using "D:\statalogs\comlog",append
I want it to read something like
Cmdlog using "D:\statalogs\comlog"+"$S_DATE"
or some other unique identifier but every time I try it, the program
aborts
when it gets to the '+' sign. Can someone please tell me how to get
this to
work.
Many thanks in advance.
Donald W Spady MD, MSc
Departments of Pediatrics and Public Health Sciences
8226B, Aberhart Centre 1
University of Alberta
Edmonton, Alberta,
CANADA
T6G 2J3
780-407-1244: Office
780-407-7136: FAX
Nature has no reset button!
*
* 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/
This message is intended solely for the designated recipient(s). It may contain confidential or proprietary information and may be subject to confidentiality protections. If you are not a designated recipient, you may not review, copy, or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message.
Arrowstreet Capital, L.P. is an Equal Opportunity Employer.
*
* 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/