There are three steps to setting a profile.do file:
- Write a do-file
- Save it in the appropriate location (more on this in a moment)
- Restart Stata and check to Results window
To write a do-file in Stata's built-in editor, go to the File menu:
(I'll discuss using an external text editor in the next installment)
You'll see a blank file like this:
Next we'll write a few commands. Remember these are things you want Stata to do every time you open it. Unless you exclusively work with one dataset, I wouldn't suggest opening it through the do-file. This is more "background": how much memory do you want allocated, where do you want the working directory, things that won't change often.
Here's our simple do-file:
It does three things:
- Sets the memory to 20m (the default is 1m). This can be done in the regular preferences pane also.
- Changes the working directory from "/Documents" to "/Documents/stata work/"
- Checks for updates to the executable and the .ado files.
Now, most importantly, you need to save the .do file in the right location. It needs to reside in the Libraries/Application Support/Stata directory:
Re-start Stata and you should see something like this:
Success, the profile.do file is running as it should.
Next we'll deal with Step 3: Choosing an External Text Editor