{smcl}
{* 24 Nov 2008/8 Dec 2008}{...}
{hline}
help for {hi:panelthin}
{hline}

{title:Identify observations for possible thinned panel dataset}

{p 8 17 2}{cmd:panelthin} 
[{cmd:if} {it:exp}]
[{cmd:in} {it:range}]
, 
{cmdab:g:enerate(}{it:newvar}{cmd:)} 
{cmdab:m:inimum(}{it:#}{cmd:)} 
  

{title:Description}

{p 4 4 2}{cmd:panelthin} identifies observations that would belong in a
thinned panel dataset in which observations in each panel are at least a
minimum time apart.  The result is a new variable tagging observations
in the thinned dataset by 1 and others by 0.  


{title:Remarks} 

{p 4 4 2}{cmd:panelthin} assumes {help tsset} data and automatically
works separately on each panel in a panel dataset. 

{p 4 4 2}In essence, the first observation in each panel is selected,
then the next after at least a minimum time, and so on. 

{p 4 4 2}If a thinned dataset is acceptable, then (provided that the
main dataset is {help save}d elsewhere) {help keep} the set with 
observations tagged 1 in the new variable. 


{title:Options} 

{p 4 4 2}{cmd:generate()} specifies the name of a new variable to include 
tags for selected observations. It is a required option. 

{p 4 4 2}{cmd:minimum()} specifies the minimum acceptable spacing in the
units of the time variable defining the panel. It is a required option. 


{title:Examples}

{p 4 4 2}{cmd:. tsset id time}{p_end}
{p 4 4 2}{cmd:. panelthin, min(5) gen(OK)}{p_end}
{p 4 4 2}{cmd:. browse id time OK}{p_end}
{p 4 4 2}{cmd:. keep if OK}{p_end}


{title:Author}

{p 4 4 2}Nicholas J. Cox, Durham University, UK{break} 
n.j.cox@durham.ac.uk


{title:Acknowledgments}

{p 4 4 2}This problem was suggested by Rajesh Tharyan on Statalist.
{browse "http://www.stata.com/statalist/archive/2008-05/msg00772.html":http://www.stata.com/statalist/archive/2008-05/msg00772.html}

{p 4 4 2}Leny Matthew signalled a bug in an earlier version. 


{title:Also see}

{p 4 13 2}On line: help for {help tsset} 


