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

# RE: st: looking for more efficient programming for randomly shuffling list of numbers

 From Evelyn Ersanilli To "statalist@hsphsun2.harvard.edu" Subject RE: st: looking for more efficient programming for randomly shuffling list of numbers Date Fri, 27 Aug 2010 10:37:46 +0100

```Thank you all for these wonderful suggestions!

@Steve
The idea is that first all household members are listed in the household grid. Then the interviewer will cross off the numbers on the stickers until s/he finds and number (= HHmember ID) that refers to an eligible HH member.
Let's say there are 20 HH members, with three eligible (ID numbers 2, 6 and 17).
If the sticker looks like
8 - 5 - 17 - 4 - 2 - 19 - 12 - 7 - 1 - 20 - 18 - 3 - 16 - 15 - 6 - 9 - 13 - 11 - 10 - 14
The randomly selected person in this case has ID 17
It is a method that has been used by the Worldbank in their LSMS studies.
I am aware of other methods such as the Kish grid, and first/last birthday methods, but these all have their disadvantages as well, especially in the developing and transit country context that we will do the interviews in.

Kind regards

Evelyn

RE: st: looking for more efficient programming for randomly shuffling list of numbers
________________________________________
From
Nick Cox <n.j.cox@durham.ac.uk>
To
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject
RE: st: looking for more efficient programming for randomly shuffling list of numbers
Date
Fri, 27 Aug 2010 09:46:42 +0100
________________________________________
A very minor point, but -ceil(20* runiform())- is also a nice way to get uniform integers 1 ... 20 (for "any value of 20").

Yet another posthumous nod to Kenneth E. Iverson, who came up with the names floor and ceiling for the round up and down functions yielding integer results.

Nick
n.j.cox@durham.ac.uk

Jeph Herrin

**************
clear all
set obs 9600
set seed 85999283
gen str60 sticker=""
gen num=.
forv i=1/20 {
replace num=floor(20*uniform())+1
replace sticker=sticker+" "+string(num)
}
drop num
**************

?

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