DO-FILE EDITOR ENHANCEMENTS


DO-FILE EDITOR ENHANCEMENTS IN ACTION!

AUTOMATIC BACKUPS

While working in the Do-file Editor, disaster strikes and a brownout occurs. We temporarily lose power, and all our unsaved edits to our do-file are seemingly lost. However, Stata’s Do-file Editor had been saving our edits periodically to a backup file. When we attempt to open our do-file again, the Do-file Editor notices that there is a backup file and presents us with the option to recover the backup.

 

We click the Recover backup button to recover the backup file. Stata opens the backup file in the Do-file Editor and deletes the backup file from disk. You can now choose to save the backup file or just close it to discard the changes. To prevent you from accidentally overwriting the original file, Stata uses a different filename by adding the string [Recovered] to the filename. When saving the recovered file, you can save it as a new file or overwrite the original file.

 

© Copyright 1996–2024 StataCorp LLC. All rights reserved.

If we had clicked the Open original button, the original file would have been opened in the Do-file Editor and the backup file would have been deleted. If we had clicked the Cancel button, no file would have been opened and the backup file would remain on disk. We would then be able to recover the backup file later.

 

USER-DEFINED KEYWORDS

Our do-file stpm2.do reproduces the examples in the postestimation help file for the community-contributed command stpm2, which fits flexible parametric survival models. These examples explore the effect of hormonal therapy on recurrence time using the brcancer.dta breast cancer dataset. With our do-file loaded into Stata’s Do-file Editor, Stata commands such as webusestset, and predict are syntax highlighted, but the community-contributed command stpm2 is not. We’ll fix that by creating a text file containing the keyword stpm2 and saving the file as stata-userkeywords.txt in our home directory. After restarting Stata and opening our do-file in the Do-file Editor again, we now see that the stpm2 command is syntax highlighted as a user-defined keyword.