Absolutely. However, there are cases in which a program (usually a
subroutine to some other program) should exit without returning error.
Thanks, ben
Scott wrote:
> If you add a return code, then the code will stop within the loop:
>
>
> prog foo3
> local num 1 2 3
> foreach n of local num {
> if "`n'"=="2" {
> di "`n' => exit"
> exit 119
> }
> di "`n'"
> mac shift
> }
> di "not to be reached"
> end
>
> . discard
>
> . foo3
> 1
> 2 => exit
> r(119);
>
>
> prog foo4
> local list 1 2 3
> foreach l of local list {
> di "`l'"
> exit 119
> }
> di "howdy"
> end
>
>
> . foo4
> 1
> r(119);
*
* 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/