I want to run a loop in which the seed changes for every single run:
Code:
forvalues mc = 1/100 { * global - seed setter! - same seed in every dofile global mc `mc' set seed `mc' use "${data}run_monte_carlo.dta", clear xtset pid syear *** run do-files do "${do}dofile_1.do" do "${do}dofile_2.do" save "${data}loop.dta", replace use "${data}monte_carlo.dta", clear merge 1:1 pid syear using "${data}loop.dta", keep (1 3) keepusing (varnames) nogen save "${data}monte_carlo.dta", replace }
I also want to set the seed in the dofiles 1 and 2 to `mc'.
How can I do that? Any help would be really appreciated.
Thank your very much in advance.
0 Response to global or local seed setting in loop
Post a Comment