>
> Here's the code again:
>
> reshape long own type , i(firm)
> * !!! replace 4 as appropriate by #firms + 1
> bysort firm (own) : gen rank = 4 - _n
> keep firm own type rank
> reshape wide own type , i(firm) j(rank)
>
There's a bug here if -own*- is missing.
Then the sort order is not what you want.
Here is version #2:
reshape long own type , i(firm)
replace own = 0 if own == .
* !!! replace 4 as appropriate by #owners + 1
bysort firm (own) : gen rank = 4 - _n
keep firm own type rank
reshape wide own type , i(firm) j(rank)
Nick
[email protected]
*
* 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/