Statalist


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

Re: st: minor annoyance


From   David Radwin <radwin@berkeley.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: minor annoyance
Date   Thu, 7 Aug 2008 11:14:18 -0700

Jeph,

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 profile.do file.

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

David

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 // radwin@berkeley.edu
Office of Student Research, University of California, Berkeley
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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