Statalist


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

st: AW: counting members of groups in unbalanced panel data


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: counting members of groups in unbalanced panel data
Date   Fri, 2 Oct 2009 16:54:09 +0200

<> 



-bysort- is always a good place to start for this sort of problem, but you
also want to have a look at -collapse- and -contract-



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Oliver
Weidenmueller
Gesendet: Freitag, 2. Oktober 2009 16:49
An: statalist@hsphsun2.harvard.edu
Betreff: st: counting members of groups in unbalanced panel data

Hello everyone

I am having troubles figuring out how to in a panel data structure to derive
some descriptives.

In my data

- there are mutliple companies, each having 1 to many funds
- each fund being of one of 11 strategies
- each fund only showing observations for part of the total sample period.

I require

- the total number of companies per month
- the average (median, max) number of funds per company per month
- the average (median, min, max) number of strategies per company per month 

The data format is for example like this:

CompanyID      FundID             Strategy           Date             Return
3021                 205                  2          Jan 94             X
3021                 205                  2          Feb 94             X
3021                 405                  3          Jan 94             X
4671                 904                  9          Feb 94             X
4671                 904                  5          Mar 94             X
4671                 154                  1          Mar 94             X
...

Number of funds per family per month was easy:
by companyid mydate ,sort: egen perfamnrofunds = count(R)

But now I ran into troubles. I would greatly appreciate if anyone could
help.

Thanks in advance,

Best regards,

Oliver 



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


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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index