FAQ/rand - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the odd characters out in each group: abz2a 125t7 HhHaHh year.s 5433r21 worl3d

Revision 5 as of 2007-08-15 14:40:31

location: FAQ / rand

How do I generate a random sample in EXCEL?

Let us suppose we wish to randomly sample n cases of data comprising N people.

1. Put =RAND()*N in row 1 of the column adjacent to the right most data column in the spreadsheet

2. Copy and paste into remaining N-1 rows

3. Go to Data>sort on the EXCEL menu and make sure you sort in ascending order by the column you have just created. Click OK.

4. Delete rows n+1 to N.

We have randomly permuted the data rows so that the first, or any adjacent, n rows represent a random sample of size n.

[http://www.stanford.edu/class/msande121/Materials/ExcelTut.pdf More on the rand() function].

There is also easy to use syntax to perform this in SPSS.