I've defined a program that generates random data and calls two estimation commands: reg and ppml. I want to store the regression coefficients from each command.

Code:
capture program drop case1
program case1, eclass
  clear
  set obs 1000
  gen z1 = runiform()
  gen z2 = runiform() < 0.2
  gen mu = exp(z1 + z2)
  gen lognorm_sd = 1/mu
  gen epsilon = exp(1 + lognorm_sd*rnormal())
  gen x = epsilon*mu
  gen lnx = log(x)
  reg lnx z1 z2
  ereturn scalar case1_b1 = e(b)[1]
  ereturn scalar case1_b2 = e(b)[2]
  ppml x z1 z2
  ereturn scalar case1_bp1 = e(b)[1]
  ereturn scalar case1_bp2 = e(b)[2]
end
I then want to perform a Monte Carlo simulation that calls this program and then summarizes the regressions coefficients across the simulations:

Code:
simulate case1_b1=e(case1_b1) case1_b2=e(case1_b2) case1_bp1=e(case1_bp1) case1_bp2=e(case1_bp2), reps(1000): case1
summarize case1_*
Unfortunately I get the following error:
Code:
invalid syntax
an error occurred when simulate executed case1
r(198);
My guess is that I've stored and.or accessed the estimation coefficients incorrectly, but I haven't found anything in the docs on this case. Can anyone spot the error?