Information about Stata macros: number of elements and order within locals and globals

Especially when running loops (see our posts here), it can be important to get more information about a macro, such as the length, or its first or last element.

Continue reading “Information about Stata macros: number of elements and order within locals and globals”

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”