Thank you, Jessica, Clyde and Kreshna. I ran into this same problem and found the statement in the help file curious.
I modified the provided code and demonstrate that it does work:
I modified the provided code and demonstrate that it does work:
Code:
lear all set more off macro drop _all scalar drop _all set seed 123456 capture program drop test program define test, rclass syntax [, nobs(integer 10)] preserve set obs `nobs' scalar state1 = substr(c(rngstate), 1, 2000) scalar state2 = substr(c(rngstate), 2001, 4000) scalar state3 = substr(c(rngstate), 4001, .) g x = rnormal() sum x, mean return scalar x_avg = r(mean) restore capture post buffer (r(mean)) (state1) (state2) (state3) end postfile buffer double x_avg str2000(state1 state2 state3) using results, replace simulate, reps(3): test, nobs(10) postclose buffer use results, clear gen strL state = state1+state2+state3 drop state1 state2 state3 * Demonstration that the each replication can be replicated local selectstate = state[2] set rngstate `selectstate' test, nobs(10) return list
Comment