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]

From |
Phil Clayton <philclayton@internode.on.net> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Dropping Program Saved as an ado-file |

Date |
Wed, 5 Sep 2012 09:27:01 +1000 |

You're after: program drop Rather than: drop program Phil On 05/09/2012, at 8:44 AM, Christoph Engel wrote: > Dear readers of Stata list, > > On the following programming problem, your help would be greatly appreciated. > > I am writing a program, which I wish to save as an ado-file. The program consists of two components: a maximum likelihood estimator, and the program calling the estimator. I need several auxiliary variables that are available in both components. I have found out that this works if I generate them as _x-variables, i.e. as variables with the variable name preceded by an underscore (assuming that users are very unlikely to have such variable names in their original datasets). > > I begin my program with > > capt drop program myprogram > > and then use > > capt drop _x > capt drop _y > (... one line for each auxiliary variable) > > If I call the program from a do-file, this works just fine. But once I save the program as an ado-file, to make it automatically available, the program is no longer dropped when it is executed for the second time. This creates a problem (only) if users break the execution of the program; otherwise I drop all auxiliary variables at the end of my program. > > The best I could find on Statalist is this answer by Nick Winter > > http://www.stata.com/statalist/archive/2004-12/msg00568.html > > This helps to understand, but not to solve my problem. Currently, the best I have come up with is adding a note to the help file: if users break the program, they should use "discard" before they reexecute the program. Is there a way to put this directly into the program? > > Many thanks for any help! > > Christoph Engel > > > _________________________________________________________________ > Prof. Dr. Christoph Engel > Max-Planck-Institut zur > Erforschung von Gemeinschaftsgütern > Max Planck Institute for Research on Collective Goods > Kurt-Schumacher-Strasse 10 > D 53113 Bonn > Tel. +49/228/91416-10 > Fax +49/228/91416-11 > e-mail:engel@coll.mpg.de > http://www.coll.mpg.de > http://www.coll.mpg.de/engel.html > http://ideas.repec.org/e/pen22.html > http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=251559 > _________________________________________________________________ > > > > > > > > > > * > * 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/ * * 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/

**References**:**st: Dropping Program Saved as an ado-file***From:*"Christoph Engel" <engel@coll.mpg.de>

- Prev by Date:
**st: RE: st " "Dummy Endogenous Variables in a Simultaneous Equation System" Hekman 78 in Stata** - Next by Date:
**st: Estout: suppressing significance stars on constant term** - Previous by thread:
**st: Dropping Program Saved as an ado-file** - Next by thread:
**Re: st: Dropping Program Saved as an ado-file** - Index(es):