Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

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


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: "bsample" and "set seed" together do not work!
Date   Fri, 17 Sep 2010 09:15:01 -0400

Your program works for me, if I eliminate the "start" line.

The FAQ ask that you show us what you typed exactly and what Stata
said. .  If you don't show us  the results,  we can't tell what your
mistake is.

Steve

On Fri, Sep 17, 2010 at 8:04 AM, Daniele Pacifico
<[email protected]> wrote:
> 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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index