Thursday, February 21, 2008

Using TextWrangler Stationery with Stata

In addition to its other wonderful features, you can use TextWrangler to save ready-made Stata templates. For example, I'm dealing with the 1975 Fraternal Order of Police study on gambling arrests. Most of the time when I open Stata, I'm dealing with this file. However, it's not something I want to write into my profile.do file, because I sometimes use other files.


Each time I deal with the 1975 data, I want to do four things (at least):

  1. Set the memory to 10m; it's a small dataset and doesn't need a large memory allocation.
  2. Open the original file.
  3. Save it as a working file.
  4. Start a log.


Textwrangler makes this easy with stationery. You can save any file as a stationery file that will be available in the File - New menu in the future.


Here's a quick guide to setting up some Stata stationery in Textwrangler


Open TextWrangler. Type in the desired text:


template text


Save this file in the stationery folder:


saving in stationery folder.

IMPORTANT: the file must be saved in the Textwrangler Stationery folder in Application Support. So save to ~/Users/adamjacobs/Library/Application Support/TextWrangler/Stationery. Otherwise this won't show up in the dialogue:


Now we open Textwrangler and select "New With Stationery":


open stationery dialogue

And here is our new document, already formatted with the desired memory, log, save path and data file.

untitled doc with stationery




As far as I know, there's no limit to the number of templates you can have. Start using stationery and you can save a lot of typing (or mousing) over the next year.


Technorati Tags:
, , , ,