Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Re: Make ado file end processing of calling do file

From   "Joseph Coveney" <>
To   <>
Subject   st: Re: Make ado file end processing of calling do file
Date   Tue, 24 May 2011 09:55:11 +0900

Paul Burkander wrote:

I'm new to writing ado files, and I'm having some trouble.  I'd really
like my ado file to stop the processing of the calling do file if
certain conditions are met.  I guess "exit" just returns control to
the calling program.

Is there any way to make the calling program completely top based on a
condition encountered in the ado file?


Well, an ungraceful-but-effective way is to put

if `certain_conditions' exit = 1 // choose any informative nonzero integer here

in your called ado-file.  This will stop everything and return control to
Stata's command prompt.

But it might be better to have a little more coupling between your calling and
called ado-files than this.

Joseph Coveney

=== begin ===

version 11.2

program define caller
	version 11.2

	display in smcl as text "caller terminated normally"

program define called
	version 11.2

	if 1 == 1 exit = 1



=== end ===

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index