Statalist The Stata Listserver


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

Re: st: set seed and gsample


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: set seed and gsample
Date   Wed, 07 Mar 2007 21:12:16 -0500

At 05:58 PM 3/7/2007, ��� wrote:
Dear All,

I am trying to draw a PPS sample using the "gsample" command.  I want
to make sure I get the same sample each time I invoke the gsample
command by using the "set seed" command. However, even after I set the
random seed using "set seed" command, I still get different sample
each time. Has anybody encountered this problem? Thanks!

Best,
Shige
Like Nick says, we'll need to see the commands; and better yet would be a reproducible example. Here is an example of where it works fine:

. webuse auto, clear
. gen id = _n
. set seed 123
. gsample 10
(1 observation created)
(65 observations deleted)

. list id

+----+
| id |
|----|
1. | 68 |
2. | 1 |
3. | 21 |
4. | 35 |
5. | 42 |
|----|
6. | 50 |
7. | 46 |
8. | 65 |
9. | 1 |
10. | 31 |
+----+

. webuse auto, clear
. gen id = _n
. set seed 123
. gsample 10
(1 observation created)
(65 observations deleted)

. list id

+----+
| id |
|----|
1. | 68 |
2. | 1 |
3. | 21 |
4. | 35 |
5. | 42 |
|----|
6. | 50 |
7. | 46 |
8. | 65 |
9. | 1 |
10. | 31 |
+----+



-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam


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