Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: Re: st: From spell to person-month file


From   n j cox <n.j.cox@durham.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Re: st: From spell to person-month file
Date   Wed, 29 Mar 2006 11:51:16 +0100

Thanks for this. But the word I introduced was "by-pilot"
from the Stata command -by:-. In Stata poetry, that would
rhyme with "sky-pilot".

More seriously, and much more importantly, I am not knocking
(or mocking) -merge-. -merge- is a superbly useful command.

The Editors of the Stata Journal, for example, would love
to see a tutorial article on -merge- and its many uses.

Nick
n.j.cox@durham.ac.uk

Ronnie Babigumira

My gut feeling was that there was neater and cleverer way of doing this so I hesitated to a response. However since I
had been bugging Anna to provide an illustration I decided to offer my rather longish take.

Im glad I did because I have learn't something new (and in the process I have moved a step closer to being a bi-pilot)

n j cox wrote:
> This is the merge-Meisters versus the by-pilots all
> over again.
>
> That is, some people set this kind of thing up as a dance
> of the files, with elaborate pas de deux fit for Fonteyn
> and Nureyev in their prime;
>
> others prefer to do it less balletically in place.
>
> I'm a by-pilot. To get from this
>
> Persnr n_job beg end sect
> 1 1 1 3 1
> 1 2 4 7 3
> 1 3 8 10 2
>
> to this
>
> Persnr month n_job sect
> 1 1 1 1
> 1 2 1 1
> 1 3 1 1
> 1 4 2 3
> 1 5 2 3
> 1 6 2 3
> 1 7 2 3
> 1 8 3 2
> 1 9 3 2
> 1 10 3 2
>
> I would go
>
> gen length = end - beg + 1
> expand length
> bysort persnr (n_job) : gen month = _n
> drop length
>
> Nick
> n.j.cox@durham.ac.uk
>

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




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