From "Ni Frank" To statalist@hsphsun2.harvard.edu Subject st: PLEASE HELP ME! Date Sun, 20 May 2007 01:33:53 -0400

Hi,

Can anyone help me to deal with the following dataset? I have thought about it for the whole day….

Here is the simplified version of my dataset

+----------------------------------------------------------------------------+

ID wage jobtype period1 period2 period3
-------------------------------------------------------------------------------

1. 1 30 1 1 1 0 2. 1 20 2 1 0 1 3. 2 40 1 1 1 0 4. 2 35 1 0 1 1 5. 2 10 2 0 0 1 --------------------------------------------------------------------------------+

That is, in this dataset there are N individuals and M periods. In each period each individual can have either one or more than one jobs. Each job is accompanied by some wage.
In the real dataset, both N and M are large.But here is one simplified example with N=2, M=3. period1, period2, period3 are time dummies. The example says, in the period 1, individual 1 has two jobs (type 1 and type2) and the associated wages are 30 and 20 respectively. In period 2, individual 1 only has one job which is type 1. In period 3, individual 1 has one job which is type 2. Similarly, we can read the job and wage information for individual 2 during these three periods.

My questions is, how to write a code to generate some variables which contain the following information: (1) the number of job each individual has in each period; (2) the maximum wage for each individual in each period. That is, I want to obtain the following information from the above dataset, where, for example, (2,30) means in period 1 individual 1 has 2 jobs, and the maximum wage is 30.

+------------------------------------------------------+
ID period1 period2 period3 ---------------------------------------------------------
1. 1 (2, 30) (1, 30) (1, 20) 2. 2 (1, 40) (2, 40) (2, 35) ----------------------------------------------------------+

Is there anyone who knows how to write this code? Please help me if you know! Many many thanks!!

Frank

_________________________________________________________________

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/