Piecewise execution of do-files in Stata

Do-files in Stata easily get a bit lengthy. Of course, you can try to shorten do-files and distribute code onto several do-files and have one master file that runs all of the respective sub-do-files (which are included by do dosubfile1.do). Alternatively, you can leave the do-file longish but write your code such that you only run parts of the code at once:

Continue reading “Piecewise execution of do-files in Stata”

Blockwise copy & paste in Stata

Simple method to clockwise edit text in do-files

I’m not sure whether it is was always there or whether it just came with an update, but finally I have found out how to blockwise copy & paste in the Stata do-file editor. What I used to do with other text editors (mostly with WinEdt), is now possible with Stata’s built-in editor. Continue reading “Blockwise copy & paste in Stata”

Ado-files: check and install automatically

If you need a certain ado-file to run your do-file and you are working on different computers, there is a way that Stata checks whether the needed ado-files are installed and that needed ado-files are automatically installed if they are not yet Continue reading “Ado-files: check and install automatically”

Preamble in do-files

When writing a lot of do-files during a research process it is hard to keep track of what a do-file was for, what it needs in terms of input, and what it generates in terms of output. Especially, if you get your paper back from the (journal) referees with comments what you should change, and want to re-run some part of the analysis — a year after you have done it –, it is hard to remember exactly what you need to do.

I use a preamble in my do-files to document (somewhat) this information, but also to set a couple of standard pointers that make my work easier …
Continue reading “Preamble in do-files”