Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Dropping programs


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Dropping programs
Date   Mon, 28 Mar 2005 17:45:20 +0100

-capture program drop- imposes a slight overhead
and should thus be left off the top of any program
you are not currently developing. On the other hand, 
you'd be sharp if you noticed a change in Stata's performance.  

Conversely, the irritation or confusion possible 
given different versions, old and new, is such that 
I edit ados using -fedit- from SSC, but modified 
so that it uses my favourite editor. This builds in 
an automatic -discard- of everything. In machine 
terms that's wasteful, but I'm valuing my own time
and stress more highly, as any programmer should. 

Nick 
n.j.cox@durham.ac.uk 

Jun Xu
 
> I would guess the function of cap program drop is to prevent 
> error while 
> doing some live editting. For example while you use do file 
> editor (or 
> textpad) to write an ado file, if you don't insert a line of 
> cap program 
> drop at the very beginning, then every time you make a change 
> and you want 
> to rerun your ado file, it will give your an error message 
> because the 
> program name is already defined. You can check into the ado 
> folders. Some 
> ado's have that line, others don't. My guess is that cap 
> program drop is 
> some leftover for doing live editting (trial and error 
> process of writing the ado file).
 
Richard Williams 

> >At 10:37 PM 3/26/2005 -0600, Jun Xu wrote:
> >>I think you probably have to rerun the ado file or discard 
> it first. I 
> >>think that's way how it works. Though you specified cap 
> program drop 
> >>myprog in the ado file, without truly running the ado file, 
> this line is 
> >>not executed by simply overwriting the old ado file. The 
> old ado version 
> >>is still in memory. My guess is that once an ado command is 
> executed, it's 
> >>in memory and unless you EXECUTE (do myprog.ado) the new 
> version or tell 
> >>Stata to discard, Stata won't execute the newly updated 
> ado. Others might 
> >>have comments.

> >Thanks Jun.  I still wonder if I am doing something wrong or missing 
> >something obvious, as I've seen other programs start with 
> -capture program 
> >drop progname-.
> >
> >Anyway, I have found a solution.  I've written a program whose sole 
> >function in life is to call the program I am editing/debugging:
> >
> >program define x
> >         capture program drop myprog
> >         myprog `0'
> >end

*
*   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/



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