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 at the end of May, and its replacement, statalist.org is already up and running.


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

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


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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index