Announcement

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

  • Retrieving user-written command while Stata is open

    Hello all,

    I wrote a program within a .do file and was having some debugging issues, so I moved it over to a second Tab Group so that I could edit it more easily without scrolling up and down. I got the version in the second tab working nicely and then I closed it without saving. I'm wondering if there is any way that I can retrieve the code. I'm thinking of something like the -vewsource- command, but for a program that isn't saved in a .ado file. Thank you for any help you can provide.


    HTML Code:
    capture program drop myFavProgram
    program define myFavProgram
        version 16
    display in red "Here is your program code, Michael"
    end
    
    viewsource myFavProgram
    Last edited by Michael Costello; 11 Aug 2022, 15:19.

  • #2
    program dir and program list may help.

    Comment


    • #3
      If the program is currently loaded into memory in Stata, you may be able to recover its content with -program list-.

      Edit: Oh, looks like I'm late to the party.

      Comment


      • #4
        Brilliant, thank you both!

        Comment

        Working...
        X