The notepad button opens a new do file
However, I'll suggest that you use an external text editor instead of the built-in text editor.
I'm not a snob about this. I still use the menus for many commands, especially new ones I'm not familiar with. However, eventually you'll have to write long files to:
Using a text editor is easier for the following reasons:
- Text editors make search-and-replace easier if you make a systematic mistake
- Text editors allow you to have Stata closed while writing
- Text editors (at least the ones outlined here) highlight syntax, which is invaluable for checking your code
- Text editors just have more options than the built-in editor (keyboard shortcuts, multiple views, ready-made templates)
- Text editors, as the name might suggest, make editing existing .do and .dct files much easier
As far as available editors for Mac, there are many. Look around VersionTracker and you'll find all sorts of free or cheap options, like SubEthaEdit, TextWrangler, Smultron, Vim, and lots of others.
If you're willing to pay a bit more, there are very full-featured programs like BBEdit ($49 US educational, $125 otherwise) and TextMate (39 Euros). Although these are impressive, they are geared much more towards professional web developers and are, in my opinion, a bit of overkill for Stata.
I can't say I've tried all of these, of course. But I've experimented with a number of editors, including the built-in TextEdit, Taco Edit, Aquamacs, Smultron and TextWrangler.
Unlike some built-in OS X software, TextEdit isn't too impressive. There are far better choices for free.
Taco Edit is really designed for HTML coding, not other languages.
Aquamacs is pretty good, some people really swear by it, including many of the skilled and serious programmers I know. The main objection I had was that it was much more difficult to integrate with Stata. You need to install a series of .ado files into Stata to make Aquamacs work as an external editor. Read this if you're interested.
I haven't tried Vim.
So we're down to two contenders:
Smultron (open-source, freeware)
Smultron is nice. It has a pleasant Cocoa interface. It handles multiple open files easily. It doesn't take much memory. Here's a screenshot:
TextWrangler (non-open-source, freeware)
However, I'm going to recommend TextWrangler, the free version of BBEdit developed by Bare Bones Software. Here's what it looks like:
Most importantly, TextWrangler integrates extremely easily with Stata:
- Save a file with a .do extension, and TextWrangler will immediately recognize it as a file that should be formatted according to Stata syntax and run in Stata.app
- The defaults can be set so new files are always formatted as .do files
- Once you've saved a .do file, you can quickly run it in Stata like this:
Click the button on the right and the file will pop up in the Finder window:
Double-click the file in Finder and it will immediately run in Stata; if Stata is closed, it will immediately open it and run it.
And here's a really nice feature: at the bottom of TextWrangler, you can select your language and it will immediately recognize the command words. So if you need to do some website editing in CSS or HTML (as I sometimes do), TextWrangler is very helpful for that as well.
While you can't go wrong with either Smultron or TextWrangler, I'd recommend the latter as a free, full-featured, do-it-all program for Stata coding.
Next installment will deal with Step 4: Importing Unformatted Data