Recording time stata needs for running a file

Running do-files with a large number of simulations or iterations often takes a lot of time. Either just for fun or in order to make your do-file more efficient, you may want to record the time Stata needs in order to run the whole file or just a part of it. The solution is –timer–. Just specify in the beginning

timer clear
timer on 1

run your simulation here

timer off 1
timer list 1

The –timer list– command will you the number of seconds needed in between –timer on– and –timer off–.

You may also specificy up to 100 different (also nested) timers, which have to be named differently by integers from 1 to 100.

Leave a Reply