ABSTRACT

Stata, for the casual user, offers a nicely implemented GUI (graphical user interface), which makes it easy to use, but its real strength lies in its expandability with user-written routines. It may be surprising, but a large part of Stata is actually written and implemented with its own built-in language. These programs can actually be viewed by the user wishing to see how a function is implemented or to learn more about programming. These files are stored in the Stata folder in the Applications folder (locations may be different based on operating systems). When your program is updated, the updates often contain many of these programs. In addition to these official updates, it is possible to download and use user-written programs that expand Stata’s capabilities. You may be interested in which commands are built into the Stata program and which are written as Stata commands. Stata has a command to do just that. Enter the following:

This results in the following output:

This output indicates the pathname to where the file is located, the file’s internal version number, and the date of its latest change. The pathname above is how it will appear on a Macintosh and will appear slightly different on a Windows or Unix computer. If, however, you entered

the output would be

Stata uses the convention of adding .do or .ado as extensions to program files. These files are actually just text files that Stata interprets as executable programming code. The .do extension refers to a do-file as it is called because it does something. These files must first be loaded into computer memory before they can be used by the user. It differs from an ado file in that an ado file is loaded into memory and executed in one step. That is, a command that is implemented as an ado file when typed into the Command window in the correct format will automatically load and run. This makes the ado files seamless to the user, acting as if they are part of the Stata program. If the do-file has been saved it also can be invoked by using the do command followed by the file name. Stata will then look in specific directories and the working directory for the file and execute the commands in the so-named dofile. If it cannot find the file, it will return a file not found error.