Can anyone tell me why the following two sub-routines would generate
different results? This code is buried in the middle of a long
estimation program. I'm trying to get away with imposing on you as
little of the program as possible -- not sure if this will be enough to
tell. "trial2" is a variable in the dataset.
Original approach:
.gen double `dum1'=$A1*(k1+k2+k3+k4)+$C1*trial2
The original approach works fine, but I need to modify it as I write a
new program. In case it is of any help, I have one additional clue: the
residual SS is the same for both programs on Iteration 0, but grows
steadily apart after that. The modified approach provides a poorer fit
and requires more iterations to converge.
I'd guess that I'm doing tomething wrong by substituting a local macro
for a variable, but I seem to need that variable in a macro. Or maybe I
don't. Leads me to a highly related question: If I have 20 local macros
defined as `parm1' - `parm20', where the suffix indexes a "trial"
variable in the dataset, what is the best way to call those macros in my
program? If trial is a local macro, I can use:
gen double `dum1'=`parm`trial''.
But with "trial" as a variable, I haven't been able to find a syntax
that works. So I need to learn either 1) how to use a variable value as
a suffix in a local macro name, or 2) how to create a local macro that
stands in for a variable.