Thursday, January 10, 2008

Quickly Creating New .do files with DocumentPalette


DocumentPalette is an odd little freeware utility I discovered a few months ago. It's definitely not something everyone will find useful, but it does provide a way of quickly creating a new Stata .do file without ever opening Stata or a text editor.

Document Palette allows you to define file templates that can be automatically inserted into any folder. Here's an example:

I'll define a basic Stata .do file that just runs the describe and summarize commands. file

Now I'll save that file to the desktop as

save file

Now we can configure DocumentPallete to make this this default Stata file for insertion in folders. We go to preferences:

DP prefs

We click the "plus" button to add a new file format and select our desktop file:

adding file

We specify that it's a Stata .do file and add a shortcut key (s):

DP prefs again

Now it appears in our list of file formats:

new pref pane

In a Finder window, you invoke DocumentPalette by pressing:

⌃ - ⌥ - ⌘ - N

(that's Control - Option - Apple - N)

Now we insert a new Stata .do file from the DocumentPalette menu. A transparent window pops up allowing you to insert various files in this folder::

DP in action

And here it is in Textwrangler. Notice the path is ~/Documents/Thesis revision/

new file

This may seem like a lot of work just to add a basic file template. It is, but only at the beginning. What makes it much more useful is the possibility of highly specific file templates. Suppose you're doing a lot of work with the 1975 Fraternal Order of Police Survey on Gambling Enforcement (just hypothetically speaking, of course). You can make DocumentPalette automatically insert a .do file that opens this data, opens the relevant logs, and prints some summaries.

This isn't the sort of material you'd want to write into your system .do file, because you won't always be working with this dataset. But when you are, you can add new files easily without a lot of copying, pasting or repetition.

In the next post I'll deal with a related and, I believe, far more helpful idea: defining Stata stationary in Textwrangler.


The Geeks said...

Thanks for review, it was excellent and very informative.
thank you :)

Táňa Ivanovová said...

Guys, try this site: It´s for any device even for Mac. Moreover you don´t need download it and they offer 30day free trial.:)