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 <>
To, <>
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:

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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index