Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Formatted date embedded in log filename


From   [email protected]
To   [email protected]
Subject   st: Formatted date embedded in log filename
Date   Thu, 5 May 2005 10:44:00 -0500

Dear Sata-listers --

I usually embed dates in the filenames of my logs. I do so using the
macro $S_DATE, which, say the date were 1/31/2000, it write it as
31jan200. Lately, I've been want to change this format to, 01.31.2000,
for directory sorting purposes. Using the following expression, I can
create a macro with the desired format:

.local date string(date(c(current_date), "dmy"), "%dN.D.Y")
.di `date'
01.31.00

Where I'm having trouble is with embedding this macro into the filename
of my log file. The following command complains:

.log using "logs\cr`date'", replace
invalid 'dmy'
r(198);

Any syntax guru have any ideas?

Thanks,
Martin Rio

-- 
Linux is user friendly. It's just very particular about who it's friends are.
*
*   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