Statalist The Stata Listserver


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

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


From   "Patrick Woodburn" <[email protected]>
To   <[email protected]>
Subject   st: Setting today's date in a do-file
Date   Tue, 21 Nov 2006 15:36:58 +0300

Dear statalist,

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.

Best regards,

Patrick


This message (and any associated files) is intended only for the use of 
the individual or entity to which it is addressed and may contain 
information that is confidential, proprietary, subject to copyright or 
constitutes legally privileged information. If you are not the intended 
recipient you are hereby notified that any dissemination, copying, printing 
or distribution of this message, or files associated with this message, 
is Illegal. If you have received this message in error, please notify 
us immediately by replying to the message and deleting it from your 
computer. Medical Research Council deserves the right to monitor all 
communications through its networks. Any views expressed in this message are 
those of the individual sender, except where the message states 
otherwise and the sender to state them to be the views of any such entity.
[email protected]

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