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

Re: st: minor annoyance

From   David Radwin <[email protected]>
To   [email protected]
Subject   Re: st: minor annoyance
Date   Thu, 7 Aug 2008 11:14:18 -0700


If you frequently need today's date formatted as a Stata date value or some other specific format like the one below, you might find it convenient to make a global macro like $today in your file.

The risk would be that if you leave your computer (and Stata) on overnight, the macro would refer to an earlier date.


At 8:58 AM -0400 8/7/08, Jeph Herrin wrote:

Even if one isn't using it to compare with a date
variable, one usually wants to reformat before using,
and converting to a date value is the easiest way
to proceed, eg,

local today=string(date("`c(current_date)'","DMY"),"%tdCCYY.NN.DD")

David Radwin // [email protected]
Office of Student Research, University of California, Berkeley
*   For searches and help try:

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