Do-file Editor: Auto completion and more syntax highlighting


  • Create and edit
    • Do-files
    • Ado-files
    • Mata code
    • Python code
    • Markdown files
    • Stata help files
  • Autocompletion
    • Stata commands
    • Words already appearing in the Editor
    • Close parentheses, brackets, etc.
  • Syntax highlighting
    • Stata ado
    • Python
    • Markdown

Stata's Do-file Editor provided syntax highlighting for Stata. It still does. In Stata 16, it also provides syntax highlighting for Python and Markdown.

And Stata 16's Do-file Editor has autocompletion. The editor autocompletes words that already exist in the document, autocompletes Stata commands, and autocompletes quotes, parentheses, braces, and brackets.

Last but not least, you can now use spaces for indentation as well as tabs.

Stata's Do-file Editor creates and edits text files. Here is an example with autocompletion and syntax highlighting:

meta is Stata's new command for performing meta-analysis. meta has subcommands. We have typed meta, and now we have a scrollable list of the subcommands from which we can choose. Or we can ignore the list and continue typing.

Autocompletion did not wait until we had typed meta to show us the choices. It knows about all 900+ Stata commands! Once we had typed the first two letters, it showed a list of the 29 commands that start with me. After we typed the t, the list was shortened to the 13 that start with met. Right now, we are at the point of looking at the 12 that start with meta.

Eventually, we will finish writing our do-file. Then we can click on the appropriate button on the toolbar and run it. If it does not work, we can fix the file, and click to run again.

Post your comment

Timberlake Consultants