11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

[ U ] 18.11 Ado-files 241duck is considered a local subroutine of decoy. Even after decoy.ado was loaded, if you typedduck, you would be told “unrecognized command”. To emphasize what local means, assume thatyou have also written an ado-file named duck.ado:program duck. . .endbegin duck.adoend duck.adoEven so, when decoy called duck, it would be the program duck defined in decoy.ado that wascalled. To further emphasize what local means, assume that decoy.ado containsprogram decoy. . .manic . . .. . .duck . . .. . .endprogram duck. . .endbegin decoy.adoend decoy.adoand that manic.ado containedprogram manic. . .duck . . .. . .endbegin manic.adoend manic.adoHere is what would happen when you executed decoy:1. decoy in decoy.ado would begin execution. decoy calls manic.2. manic in manic.ado would begin execution. manic calls duck.3. duck in duck.ado (yes) would begin execution. duck would do whatever and return.4. manic regains control and eventually returns.5. decoy is back in control. decoy calls duck.6. duck in decoy.ado would execute, complete, and return.7. decoy would regain control and return.When manic called duck, it was the global ado-file duck.ado that was executed, yet when decoycalled duck, it was the local program duck that was executed.Stata does not find this confusing and neither should you.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!