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   Robert A Yaffee <bob.yaffee@nyu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Current date and time listed in output
Date   Sun, 28 May 2006 09:33:37 -0400

Thanks much
  RY

Robert A. Yaffee, Ph.D.
Research Professor
Shirley M. Ehrenkranz
School of Social Work
New York University

home address:
Apt 19-W
2100 Linwood Ave.
Fort Lee, NJ
07024-3171
Phone: 201-242-3824
Fax: 201-242-3825
yaffee@nyu.edu

----- Original Message -----
From: Phil Schumm <pschumm@uchicago.edu>
Date: Saturday, May 27, 2006 10:26 pm
Subject: Re: st: Current date and time listed in output

> 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/
> 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index