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

Re: st: Today in a log file


From   Dan Blanchette <dan_blanchette@unc.edu>
To   statalist@hsphsun2.harvard.edu, <MRio@crai.com>
Subject   Re: st: Today in a log file
Date   Tue, 4 May 2004 09:47:19 -0400 (EDT)

How to insert today's date into a log file name.

local path "C:\project1\"

log using `"`path'\logs\progamlog_`=subinstr("`c(current_date)'"," ","",.)'.smcl"', replace

if run today would create a log file named:
C:\project1\logs\programlog_4May2004.smcl

The subinstr function removes all the spaces.


The long way to do this would be:

local path "C:\project1\"
local today = subinstr("`c(current_date)'"," ","",.)

log using "`path'\logs\progamlog_`today'.smcl", replace

Dan Blanchette
The Carolina Population Center UNC-CH



st: Re: Today in a log file



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