
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.
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.
Learn more about Stata's Do-file Editor.
Read more about Using the Do-file Editor—automating Stata in the Getting Started manual.