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]

Re: st: creating subsamples in panel data

From   Christopher Baum <>
To   "" <>
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   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

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