How to create a do-file in STATA?
Do-file is an interface in Stata which allows the researcher to compile all the commands and results in one place. Once the commands are stored in the do-file, one does 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 a 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 “Execute” as shown below:
- The 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.