Do-file is an interface in Stata which allows the researcher to compile all the commands and results at one place. Once the commands are stored in do file, one do not need to enter the command again. One can simply run the do file and get all the results at once. Unlike SPSS wherein, the output sheet is automatically generated every time you run a test. All the commands and results in this file can be mailed together.
How to create a do-file?
- Open a do file by clicking on the tab encircled below:
- The do-file will open in new window (See below):
- Based on your previous analysis, you can either “Open” the existing do-files from “File” or can copy the command from the command window in the file.
- In order to run or execute the command saved in the do file, click on the “Execute” as shown below:
- Final step is to save it. In STATA do-file editor, click on “File” in the menu bar and click “save as”. The file is saved in “.do” format in the folder you wish to save it in.
Note: These files can be created and edited in text editors like notepad or word pad. However, they should be saved in “.do” format or else they will not run in STATA.