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

RE: st: Dropping programs


From   "Jun Xu" <mystata@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: Dropping programs
Date   Sun, 27 Mar 2005 10:11:35 -0600

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).

best,

xj.


From: Richard Williams <Richard.A.Williams.5@nd.edu>
Reply-To: statalist@hsphsun2.harvard.edu
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: Dropping programs
Date: Sun, 27 Mar 2005 09:23:48 -0500

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.

Jun
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/
_________________________________________________________________
Donít just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

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