One very small comment here. If this is run, the time 
will include the time to -drop _all-, which -- the 
very first time this is done -- could be all sorts
of different datasets in memory before the -simulate-. 
As several people may be interested in 
this or other benchmarking programs, then 
the number of sources of variability can 
be reduced by ensuring that -simulate- is 
run after -clear-. 
Nick 
[email protected] 
Daniel Feenberg
> 
> program define lnsim, rclass
>          syntax [, obs(integer 1) mu(real 0) sigma(real 1)]
>          drop _all
>          set obs `obs'
>          tempvar z
>          gen `z' = exp(`mu' + `sigma'*invnorm(uniform()))
>          summarize `z'
>          return scalar mean = r(mean)
>          return scalar Var  = r(Var)
>     end
> 
> simulate "lnsim, obs(100)" mean=r(mean) var=r(Var), reps(10000)
*
*   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/