Bookmark and Share

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

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

st: Random Sample Selection in Panel Data

From   Dennis Kramer <>
Subject   st: Random Sample Selection in Panel Data
Date   Fri, 13 May 2011 09:29:59 -0400

I have a large panel data sets (4 years-- 250,000 + records per year)
and I want to generate four random sample groups to test the stability
of the estimates. However, I want to ensure that if a ID is selected
in Year 1 then are are subsequently selected into the sample random
sample for Years 2, 3, and 4.

I know for a cross-sectional random sampling the code is as follows:

generate rannum = uniform()
egen grp2 = cut(rannum), group(4)

Does anyone have any insight into modifying the above syntax to
automatically include years2, 3, 4, ids in the same sample as the
selected Year 1 ID??

Thank you
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index