A Short Preface to this Section

Stata offers a wide array of possibilities for programming, for instance, to write "ado" files that enhance Stata's capabilities. Many users will never start writing ado files, or do some extensive programming.

Yet, this section is written particularly for the latter group of users; that's why it is called "Elements of programming". You will not learn to write full-fledged programs. But I want to call your attention to some pieces that can be used in your daily work, particularly when cobbling together a do file.

I wish to comment on one thing that is not covered here and which some people might miss. Stata enables users to define temporary variables – variables that exist for some time, but are dropped automatically later on (typically, during the run of a [section of] a do file). This may be nice when you do a lot of data transformations and file manipulation. Nevertheless, as soon as you start sharing your work, problems may arise, and that's why I do not like temporary variables. Of course, within programs they can be extremely helpful or even a requirement.

© W. Ludwig-Mayerhofer, Stata Guide | Last update: 03 Feb 2019