ADVANTAGES OF USING DO-FILES 1. You have a record of the commands you ran. You can rerun them in the future to replicate your results You can quickly modify your code 2. You can use the features of the text editor i.e. copy/paste, find and replace, select all
TWO RULES OF USING DO-FILES 1. Do-files must be robust Robust do-files produce exactly the same result when run at a later time or on another computer 2. Do-files must be legible Legible do-files are documented and formatted so that it is easy to understand what is being done
MAKING DO-FILES ROBUST Robust do-files are self-contained
MAKING DO-FILES ROBUST Exclude directory information
MAKING DO-FILES ROBUST Use version control Include seeds for random numbers
MAKING DO-FILES LEGIBLE Legible do-files are internally documented and formatted Use comments!!
MAKING DO-FILES LEGIBLE Use alignment and indentation
MAKING DO-FILES LEGIBLE Limit your abbreviations