Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: "bsample" and "set seed" together do not work!


From   Daniele Pacifico <danielepacifico@yahoo.it>
To   statalist@hsphsun2.harvard.edu
Subject   st: "bsample" and "set seed" together do not work!
Date   Fri, 17 Sep 2010 12:04:33 +0000 (GMT)

Dear Stata users,

I am working with the command "bsample"  and I discovered that the command "set 
seed #" stops "bsample" from drawing different samples from my data.. Here is an 
example:

___start example___
clear all
set obs 1000
drawnorm x
local r=6

forvalues i=1/`r'{
preserve
  bsample
  su x
  set seed 1234567890
restore
}


___end example___

I had this problem because I am writing an ado file that sets a seed when it 
runs.. However, I discovered that the seed I define within my ado file 

creates the problem I have shown you above (i.e. I cannot use bsample with the 
command defined in my ado file).. Do you have any advise about it? How can I 
"unset" the seed so as to allow it to vary randomly again with bsample?

Thanks in advance for any help.

Best,
Daniele


      


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index