Stata Help

Execute Commands Every Time Stata Opens

If you are using Stata on a personal computer (one in which you have your own individual account and password, rather than Reed's global login) you can create a series of commands to execute every time Stata opens. This can be particularly useful if you want to change what the function (F) keys do (more on that here). Essentially, if there is a command you run every time you open Stata, you can teach Stata to execute that command when it opens.

The easiest way to do this on a current Mac computer is to open Applications =>TextEdit. Next go to Format => Make plain text. The top should now read "Untitled.txt". From here, type the commands you want Stata to execute upon opening, one per line. When finished use File=> Save as... and name the file "profile.do". Save it wherever you like, but stay aware of its location. Hit enter. A box will pop up making sure you want to use the specified extension (.do), and you should select "Use do". You can always edit this file later, so don't worry if you forget something. 

Now that the file exists, you just have to drag it to your home folder => Library => Application Support => Stata. Next time you open Stata, the Review window should show your profile.do commands and their results.

Back to Tutorials

Back to Keyboard Shortcuts