What’s this about?

Stata’s Do-file Editor—its integrated text editor—is used for editing text files, including do- and ado-files that you write. Stata 15’s editor has new features.

 

Let’s see it work

One new feature is automatic code reindentation. This includes converting spaces to tabs when appropriate. Here is an ado-file that is poorly indented. Stata does not care, but you do.

 

hello.ado
program hello
args a b
if “`a’” != “” {
display “hello world a”
}
else if “`b'” != “” {
display “hello world b”
}
end

 

Open hello.ado in Stata’s Do-file Editor.

 

Select all the text.

 

Select Edit > Advanced > Re-indent.

 

And voilà:

 

hello.ado
program hello
args a b
if “`a’” != “” {
display “hello world a”
}
else if “`b'” != “” {
display “hello world b”
}
end

Resave the file.

 

See all of the features we added to the Do-file Editor in Stata 15 in the Highlights above.

 

Highlights

Automatic reindentation of program code

Visual indentation guide—tab stops as vertical lines

Converts legacy do-file character encoding to Unicode

Add or remove comments from selected text

More code folding—program, mata, and input

Visual marking of wrapped lines

Column-mode selection and editing

More color options for interface elements with Stata for Windows

Tell me more

Learn more about Stata’s Do-file Editor.

Read more about Using the Do-file Editor—automating Stata in the Getting Started manual.