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

# st: Questions relating to cases selection

 From "Dangol, Ramesh" To "statalist@hsphsun2.harvard.edu" Subject st: Questions relating to cases selection Date Tue, 27 Mar 2012 11:56:57 -0400

```STATA HELP

I am new to STAT; therefore, detailed comments will be helpful!  I have a longitudinal data set of 30 basketball teams and player performance records observed over 5 years.

Year  Players Teams minutes Performance
1          P1              T1              X1              PE1
1           P2              T1              X2              PE2
.         .             .          .            .
.         .             .          .            .
1        Pn              T1              Xn              PEn

2        P1              T1              X1              PE1
2        P2               T1             X2              PE2
.         .             .          .            .
.         .             .          .            .
2        Pn              T1              Xn              PEn

1        P1              T2              X1              PE1
1        P2              T2              X2              PE2
.         .             .          .            .
.         .             .          .            .
1        Pn              T2               Xn              PEn
2        P1              T2              X1              PE1
2        P2              T2              X2              PE2
.         .             .          .            .
.         .             .          .            .
2        Pn              T2              Xn              PEn

Question 1
I want to randomly select five players (by creating dummies) from each team and for each year.  Eventually, I want to sum player performance records, in a new variable, by team and by year.  Is there a way to do this in STATA?

Question 2
I also want to create dummies for top five players, in terms of minutes played.  Eventually, I want to sum performance scores, in a new variable, of these players by team and by year.  Is there a way to do this in STATA?

Ramesh

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