[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: [Stata 8.2] Wanted: Improved temporary variable passing
At 01:05 PM 5/9/2005 -0700, D H wrote:
* You might also consider the use of global macros. These are available to
From help styleguide:
------ Very large programs become increasingly
difficult to understand, to build, and to maintain,
roughly as some power of their length. Consider
breaking such programs into subroutines and/or use a
structure of command and subcommands.
This less-than-advanced programmer finds it difficult
to pass lots of temporary variables into Stata
(sub)programs from my master do-file. Thus, following
the preceding advice presents a challenge.
* You might be able to return, sreturn or ereturn stuff you want available
to your subroutines. Key thing is to be careful that these don't get
zapped as you go along.
* Copy code from one subroutine to the next, where you use a similar syntax
command for each routine along with, say, a bunch of local commands that
give your local variable names the names you want. Get it nailed once, and
then just keep copying from one routine to the next.
* One monster program isn't necessarily bad, especially when a routine or
task is only done once. Put lots of ****** before and after sections so
that it is clear where key sections of code begin and end.
* Get the Stata programming manual if you don't already have it. Lots of
good stuff in there. You may also want the Gould et al maximum likelihood
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
* For searches and help try: