Statalist The Stata Listserver


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

Re: st: Current date and time listed in output


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: Current date and time listed in output
Date   Sat, 27 May 2006 21:26:56 -0500

On May 27, 2006, at 8:41 PM, Robert A Yaffee wrote:
Does anyone know how I can get the current date and time to be reported in the output of an rclass program that one has written? What is the function for reporting the current date and time at which the program was run on Stata?

I'm not sure exactly what you're asking for. If you are writing a program and want to display and/or return the time at which the program is executed, you can use the following:


program foo, rclass
return local datetime = "`c(current_date)' `c(current_time)'"
di as text return(datetime)
// rest of program
end


which produces


. foo
27 May 2006 21:24:26

. ret li

macros:
r(datetime) : "27 May 2006 21:24:26"


-- Phil

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