Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: storing elapsed time in a variable


From   "Schonlau, Matthias" <matt@rand.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: storing elapsed time in a variable
Date   Fri, 27 Feb 2004 11:29:52 -0800

Dear Stata listers : 

I would like to know how much time a portion of my code takes to run. The only way I can think of is using 

set rmsg on   
or 
c(current_time) before and after the section of the program.

That gives me the time - but it is not automated. I have many different input parameters for this section of the program it would be time consuming to write all times down by hand.

Is there a way of  storing elapsed time in a variable? 

I tried it without success:  the following fails somewhere in the first two lines: 

				local timestring c(current_time)
				tokenize `timestring', parse(":")
				di "`1'*`2'*`3' "
				local hour1 = real(`1')
				local minute1 = real(`2')
				local second1 = real(`3')
				
Thanks ,

Matt 





Matthias Schonlau
Statistician, RAND 
http://www.rand.org/methodology/stat/members/matt/

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