Announcement

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

  • External do-file editor for Stata (Windows only)

    Hi all,

    I've written a package for Sublime Text 3 (ST3) which allows you to write Stata code and run it in Stata directly from ST3. I've been using it for a while and I think it works well so I figured that people reading this forum might be interested in it. The package makes use of Stata automation to send code from ST3 to Stata so it is only available on Windows machines. The package has primarily been tested using StataMP 13 on Windows 7 and Windows 8, but I have briefly tested it on both StataMP 11 and StataMP 12 and it seems to be working. The package mimics Stata's own editor as much as possible so using both ctrl + d ("do") and ctrl + r ("run") works, both on running the entire file as well running only selections. Some advantages of this editor include:
    • Clear syntax highlighting
    • Support for running code using multiple selections
    • Access Stata help files from ST3 by selecting the command for which you want access to the documentation and press ctrl + shift + n (open help file in Stata), or ctrl + shift + h (open help file in ST3). For the latter option, an internet connection is required.
    • Shorthand for creation of locals by pressing ctrl + l after the local or just `
    • Load a new Stata dataset by selecting a path and pressing ctrl + shift + u (Equivalent to the command "use 'path', clear"). Please, note that your current work will then be lost, so remember to save your dataset!
    • Some snippets and completions. Among other things, ST3 automatically scans your file and gives you completion suggestions, something I find very helpful to avoid typing mistakes. Also some snippets for commonly used commands such as foreach and forvalues loops as well as program definitions.
    • Plus all other features that come with ST3!
    The package is easiest installed using Package Control, just click here and follow the instructions. It is also possible to download the files directly from Github and installing it manually. Note that the package is still in beta and may contain bugs, so use the package at your own risk and make sure to backup your data! One known bug is mentioned in the Readme file, so please read it before using the editor. I attach a screenshot of what the editor looks like. Please let me know if something is not working or if you have suggestions for improvements!

    Best,
    Mattias
    Screenshot of StataEditor for Sublime Text 3
    Last edited by Mattias Nordin; 23 Oct 2014, 11:35.

  • #2
    For those using ST on windows, I would highly recommend it!
    S

    Comment


    • #3
      The Stata Editor package in Sublime Text has revolutionised my Stata coding experience. I am so grateful for your contribution, Mattias.

      I have a GitHub repository explaining Stata integration with Sublime Text 3. If anyone stuck at registering Stata automation library, please see https://github.com/sook-tusk/Tech_In...R_with_Editors
      for screenshots and for general guidance.

      You may also look at Stata integration with Visual Studio Code and Notepad++ for Windows PC, from the same repository. I used Friedrich Huebler's excellent code and tweaked the rundolines programme. My contribution is that I brought the cursor (focus) back to the editor, rather than leaving at the Stata window.

      I didn't include Atom editor for integration due to its technical glitches and personally do not recommend.

      I hope this integration with modern external editors helps anyone who is interested in running Stata code externally.
      Last edited by Sook Kim; 11 Dec 2022, 06:38.

      Comment

      Working...
      X