Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use an edited ado file without restarting Stata session?

    I am editing my ado file.
    Whenever I make some change, I want to check whether the edited ado file works in the way I intended.
    However, Stata seems to use the unchanged ado file even after I save the edited ado file.
    So, I am restarting Stata whenever I want to check the edited version, then it works well.
    But, you know, it is really hassle task to restart Stata very frequently.

    How can I use the edited ado file without restarting Stata session?

  • #2
    That is done by using the command:
    Code:
    discard
    
    * Consult the help file:
    h discard
    * in which you can read:   Use discard to debug ado-files.
    http://publicationslist.org/eric.melse

    Comment


    • #3
      ericmelse Thank you so much, I can save much time!

      Comment


      • #4
        -discard- is a nuclear option, isn't it? See also -program program_name drop- or -capture program program_name drop-

        Comment


        • #5
          Stephen meant to say

          Code:
          program drop program_name
          discard might get rid of more than you want, but I think in terms of developing and certifying ados, it is usually what you want.

          As an aside,

          Code:
          capture program drop program_name
          often appears inside ado-files. It is completely useless there. If there really was a program with the same name in memory, the ado-file -- including the line capture program drop ... -- would not be executed in the first place.

          Comment


          • #6
            On Daniel's first point: yes, he read my mind. (thanks)

            Comment


            • #7
              Stephen Jenkins daniel klein I understood the point. Because I have only one ado file, I had no problem so far. But, as you mentioned, program drop seems more efficient and what I exactly want. Thank you guys so much.

              Comment

              Working...
              X