Statalist


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

st: -using- option for program executed by -simulate-


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   st: -using- option for program executed by -simulate-
Date   Thu, 27 Dec 2007 15:52:56 -0600

Often when performing simulations, it is helpful to start with an existing dataset and then add to it, rather than having to create the entire dataset from scratch at each iteration. It would then seem logical to pass the location of the saved dataset into one's program via the -using- option. However, for some reason, I can't seem to get that to work (as demonstrated by this simple example):


. input group

group
1. 0
2. 1
3. end

. expand 16
(30 observations created)

. tempfile myfile

. save `"`myfile'"'
file /tmp/S_03268.000001 saved

.
. program foo, rclass
1. syntax varname using/, diff(real) sd(real)
2. drop _all
3. use `"`using'"'
4. tempvar y
5. gen `y' = `diff'*`varlist' + (invnorm(uniform())*`sd')
6. ttest `y', by(`varlist')
7. ret scalar p = r(p)
8. end

.
. simul p = r(p), reps(100): foo group using `"`myfile'"', diff(1) sd(1)
using not allowed
r(101);


I believe this error is being thrown by -_prefix_command-, as called from within -simulate-. Is there a known restriction against using the -using- option in this context?


-- Phil

*
* 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