Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: calling another .do file?


From   Neil Shephard <nshephard@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: calling another .do file?
Date   Mon, 19 Jul 2010 15:26:57 +0000

On Mon, Jul 19, 2010 at 3:21 PM, Costello, Michael (Contractor)
<mcostello/Contractor@rti.org> wrote:
> Statalist,
>
> Is it possible to have a command inside a .do file that allows you to call and execute a different .do file, then go back to the original and finish processing?
>

Yes (although a quick experiment of actually trying it out could have
answered this for you ;-).


<---Start test1.do--->
do test2.do
<---End test1.do--->

<---Start test2.do--->
di "Hello you've successfully called me from test1.do"
<---End test1.do--->

do test1



In fact you can do this multiple times and -man limits- shows you that
you can have upto 64 nested do-files.

See also [U] 16 Do-Files chapter of the Users Guide for the most
comprehensive over-view of writing do-files

Neil


-- 
"... no scientific worker has a fixed level of significance at which
from year to year, and in all circumstances, he rejects hypotheses; he
rather gives his mind to each particular case in the light of his
evidence and his ideas." - Sir Ronald A. Fisher (1956)

Email - nshephard@gmail.com
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
*   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   |   Site index