Announcement

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

  • shortcut to close all brackets

    Hi fellow Stata users,

    Is there a shortcut to close all curly brackets within a dofile? I use lots of curly brackets to organize my code, but I have to manually close them all every time I reopen the dofile. See below for an example:

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //
    // Summary Stats
    // ---->
    //
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    {


    foreach var of varlist ln_tbq post_treated post treated{
    drop if missing(`var')
    }

    eststo clear
    eststo: quietly estpost summarize ln_tbq post_treated post treated , detail


    }

  • #2
    Hi,

    It seems odd that you have to close them everytime you re-open your do-file. Surely if you make sure all your brackets are closed off before you save your file then it will re-open with them al saved. For me, if I have unclosed brackets then my code won't even run.

    Comment


    • #3
      I agree with Jenna Grabey and indeed don't understand what the question is here. Is the problem working within the do-file or that when you re-open a do-file you find that changes you thought you had made haven't been made? When the last happens to me I have to guess that it's my fault.

      What often happens that I keep tweaking a do-file and then executing the latest version. But the do-file editor won't save a file permanently unless prompted to do so.

      Comment


      • #4
        Thank you, Nick and Jenna, for responding. I'm sorry if my question wasn't clear.

        I am looking for a code folding hotkey. I use Stata 17, and I have to close all of the curly brackets each time I open a do-file, even if I save it when they are closed. I use curly brackets { } to organize and separate code for tables and figures.

        Comment


        • #5
          Same issue here, did you find help somewhere else Cayman?

          Comment


          • #6
            I find that when I type { its sibling } appears automatically. My reaction is to push it down a line or two. I don't know of other support for braces (curly brackets).

            Comment


            • #7
              If you want to open/close curly brackets or automatize some commands you use frequentry, i use the following:

              https://www.autohotkey.com/

              I generated a list of hotkeys stored in a file, which is launched every time I open stata (i did this by setting my own profile, which is launched every time I open stata).

              Comment

              Working...
              X