Economics should be open

October 13, 2009

Notepad++ and Stata, a better do file editor

Filed under: Stata — howardchong @ 1:16 am

I do not like the bult in stata editor. It makes reading stata do files a chore. I come a bit from the programming world which will show commented lines and blocks in a different color and highlight reserved words. I looked for al alternative stata text editor / do file editor and like Notepad++.

Notepad++ is a good alternative. You can still run blocks of code (like control-D) and who do file (like control-R) if you set it up. Plus it’s free.

Here’s my simple 3 step setup.

1) Download and install Notepad++

2) To get context highlighting, go here:  download the link to the stata XML file here http://notepad-plus.sourceforge.net/commun/userDefinedLang/userDefineLang_stata.xml .  Click  start, run, type (or paste in) %APPDATA%\Notepad++ then click ok. Assuming you just installed Notepad++, just copy the file you downloaded to this directory, delete the existing userDefineLang.xml and rename your file userDefineLang.xml.

3) To enable running code from Notepad++, follow steps 1-4 of the following page:

http://s281191135.onlinehome.us/2008/20080427-stata.html

It may look complicated, but it is just downloading two files, saving them to c:\ado\personal (or wherever you like), editing two setup files so it knows which stata version you use, and setting up the F9 ad F10 shortcuts.

That’s it.

You’ll get context highlighting, comment block highlighting, and keyword highlighting.

To change the colors of the highlighting, go to View | User Define Dialog

And follow the directions here: http://notepad-plus.sourceforge.net/uk/UserLanguageDefineSystem-HOWTO.php

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.