Statalist The Stata Listserver

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

st: RE: RE: Making a unique log file

From   "Charles Thibault" <>
To   <>
Subject   st: RE: RE: Making a unique log file
Date   Wed, 26 Jul 2006 13:18:04 -0400

Hi Alex,

	I used your do-file and with a few modifications (for some reason my
computer was not reading a forward slash) your code worked great.


Charles Thibault
Market Analyst,
5 Union Square West; 4th floor
New York, NY  10003
mobile: (347) 414-0218
-----Original Message-----
[] On Behalf Of Alex Ogan
Sent: Tuesday, April 25, 2006 5:29 PM
Subject: st: RE: Making a unique log file

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 =
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-----
[] On Behalf Of Donald Spady
Sent: Tuesday, April 25, 2006 5:22 PM
Subject: st: Making a unique log file

I want to make a command log file using cmdlog, but I want it to be
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
when it gets to the '+' sign.  Can someone please tell me how to get
this to

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,
T6G 2J3

780-407-1244: Office
780-407-7136: FAX

Nature has no reset button!

*   For searches and help try:

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:

*   For searches and help try:

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