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

# Re: st: creating subsamples in panel data

 From Christopher Baum To "statalist@hsphsun2.harvard.edu" Subject Re: st: creating subsamples in panel data Date Sat, 7 Aug 2010 04:04:25 -0400

```<>
On Aug 7, 2010, at 2:33 AM, David wrote:

> I have have a large panel dataset containing bank data. I have a time
> variabel and a panel variable that identifies every bank uniquely.
> Now I want to divide my data in three groups( by percentiles) by their
> asset size  to run regression for each individual group.
> I tried evey function I know about but nothing seems to work properly.
> I would be extremely grateful for every help I can get on this.If you
> wonder this is for my Bachelor Thesis and kind of new to STATA.

In order to create samples of small (<95th percentile), medium(between 95 and 99th percentile, large (>99th percentile) from my
large database of bank-quarter data:

egen cut95 = pctile(totassets) if tin(`start',`endp'), p(95) by(callqtr)
egen cut99 = pctile(totassets) if tin(`start',`endp'), p(99) by(callqtr)
g byte small = totassets < cut95
g byte medium = totassets >= cut95 & totassets < cut99
g byte large = !small & !medium

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html

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