Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: programming subroutines


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: programming subroutines
Date   Wed, 3 Nov 2004 18:35:20 -0500

Nick said

In many circumstances, I find -c_local- a useful
alternative. -c_local- is not documented but
is used quite frequently in StataCorp programs,
as a -grep- or equivalent of the official ado
files will show.

In practice, fair criteria of whether you
should use -c_local- are that

1. you can work out from examples what the
syntax is and what it does

2. you can also work out why it means that
you can mess up your own programs

3. it looks appropriate to your problem.

Nick
[email protected]


I would suggest looking at the code of rollreg.ado (available from SSC). I received advice from Nick on the use of c_local in this context to make the several repetitive components of this routine amenable to subroutines. The way in which that logic works is fairly obvious from the code: in this routine there is the need to deal with some options that may or may not be defined, which complicates the issue (in terms of traditional programming languages, the argument list is of variable length).

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index