Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Returning a local macro within -simulate- command: Type mismatch error?


From   Rachel <[email protected]>
To   [email protected]
Subject   st: Returning a local macro within -simulate- command: Type mismatch error?
Date   Thu, 29 May 2008 12:24:33 -0400

I'm running a simulation and would like to know the state of the
random number generator in each loop.   A simplified version of the
program is below.  I'm getting the error "Type mismatch r(109)"
apparently as a result of the way I'm returning the local macro
seedinit.

I may be missing something obvious, but I'd appreciate any suggestions
about how to fix this error.  Thanks very much.

Rachel


capture program drop TrialProgram
program define TrialProgram, rclass
clear
set obs 9000
local seedinit1=c(seed)
capture drop x y
drawnorm x y
regress y x
return local seedinit "`seedinit1'"
end


simulate _b _se seedinit=r(seedinit), noisily reps(30): TrialProgram
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index