Statalist The Stata Listserver

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

st: RE: Setting today's date in a do-file

From   "Nick Cox" <>
To   <>
Subject   st: RE: Setting today's date in a do-file
Date   Tue, 21 Nov 2006 12:52:56 -0000

This is often asked. See, for example, 
Svend Juul's reply

In a phrase, the answer is use `c(current_date)'. 


Patrick Woodburn
> So far, when I've wanted a do-file to treat data in a way 
> conditional to
> the date the do-file is run, I've put something like the following
> towards the beginning of my do-file:
> **************macro for today's date: UPDATE when repeat
> do-file***************
> global today "d(21nov2006)"
> **************************************************************
> **********
> *******
> (The stars are a way of emphasising the importance of this line)
> I am worried that this is prone to error, if someone forgot to change
> the date or made an incorrect guesse at the date.  Is there any way to
> automatically obtain today's date in Stata, and, perhaps, to 
> incorporate
> this into a global macro called today, so that I can make the simplest
> modification possible?  I use Stata through a Windows environment, if
> that makes any difference.

*   For searches and help try:

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