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" <[email protected]>
To   <[email protected]>
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 
http://www.stata.com/statalist/archive/2006-08/msg00548.html

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

Nick 
[email protected] 

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:
*   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