The 5 reference contexts in paper Christopher F. Baum (2005) “A little bit of Stata programming goes a long way...” / RePEc:boc:bocoec:612

  1. Start
    3902
    Prefix
    In Stata 8, considerable effort could be saved with the use of [R]statsby. In Stata 9, this notion has been extended with the [R]rolling command. The particulars ofby:usage, particularly in a panel context, has been exposited in
    Exact
    Cox (2001), and
    Suffix
    for brevity will not be discussed here. The outline of the talk: we will first discuss the use of thelocal macro, its cousinglobal,scalarand their interaction with Stata’s up-to-date constructs for repetitive work:foreachandforvalues.
    (check this in PDF content)

  2. Start
    15289
    Prefix
    elements of listAthat are not duplicated in listB, and to test lists for “equality” (defined for lists as containing the identical elements in the same order; an alternate form tests for “weak equality”, which does not consider ordering). A list function (posof) may be used to determine whether a particular entry exists in a list. An excellent discussion of many of these issues may be found in
    Exact
    Cox (2003).
    Suffix
    Scalars The distinction between macros and Stata’sscalarsis no longer numeric content, since both macros and scalars may now contain string values. However, the length of a string scalar is limited to the length of a string variable (80 in Intercooled Stata, 244 in Stata/SE: [R]limits), whereas a macro’s length is for most purposes unlimited (actually a finite 67,784 characters in Intercooled Stat
    (check this in PDF content)

  3. Start
    26446
    Prefix
    Whenever you see a set of repetitive statements in a Stata do-file, it is likely to mean that its author did not understand how one of these loop constructs could have made the program (and its upkeep) simpler. An excellent discussion of the loop commands is to be found in
    Exact
    Cox (2002).
    Suffix
    Matrices Stata has contained a full-featured matrix language, for the last several versions, and supports a broad range of matrix operations on real matrices, as described in [P]matrix. The big news with Stata version 9 is the addition ofMata, a matrix programming language which puts Stata on a par (or better!) with matrix languages such as MATLAB, GAUSS or Ox in terms of both capabilities and spe
    (check this in PDF content)

  4. Start
    30866
    Prefix
    Virtually every command—including those which you might not think of as generating results—places items in thereturn list, which may be displayed by the command of the same name.6For instance, consider [R]describe: 4A good discussion of matrices for housekeeping is presented in
    Exact
    Watson (2005).
    Suffix
    5If this distinction interests you, [R]whichwill either report that a command is built-in (i.e., compiled code) or located in a particular ado-file on your disk. 6Significant exceptions: [R]generateand [R]egen.
    (check this in PDF content)

  5. Start
    46947
    Prefix
    If you have writtenmyrealprog.ado, on the other hand, you may invoke it as the Stata commandmyrealprogas long as it is defined on the [R]adopath. A nice illustration of transforming a do-file into an ado-file is presented in
    Exact
    Watson (2005).
    Suffix
    There are more profound differences, to be sure; ado-file programs may acceptargumentsin the form of avarlist,ifexporinrangeconditions, or options. Nevertheless, one need not go very far beyond the do-file examples we display above in order to generate a Stata command.
    (check this in PDF content)