Hi,
reshape long w_job, i(ID) j(jobnum)
gsort id -w_job
by id: gen Number_job=jobnum[1]
reshape wide w_job, i(ID) j(jobnum)
Hope this helps,
Kelvin.
On 2/5/07, Hui Wang <[email protected]> wrote:
> Hi, All,
>
> I have a dataset. Each individual can at most have 4 jobs (job1-job4). For
> each individual I know the hourly wage for each job (w_job1-w_job4). I
> wonder how I can creat a variable indicating that which job has the highest
> wage. Refer to the following example. The variable I want to creat is the
> 'Number_job'
>
> ID w_job1 w_job2 w_job3 w_job4 Number_job
> 1 10 100 0 0 2
> 2 120 30 10 0 1
> 3 20 90 80 70 2
>
> Thanks.
>
> Jackie
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> *
> * 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/
>
*
* 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/