Thanks for the plug for -majority-.
However, -majority- can handle
two or more parties. Nevertheless
it is not the optimum tool here,
as (strange though it may seem)
it doesn't support precisely this
calculation.
Nick
[email protected]
Clive Nicholas
> Israel Solares Bravo wrote:
>
> > i have the following problem:
> >
> > i want to construct a variable called margin of victory:
> >
> > my data set looks something like this:
> >
> >
> > state votesA votesB votesC votesD
> > 1 10 1 6 21
> > 2 11 2 7 22
> > 3 12 3 8 13
> > 4 1 4 2 3
> > 5 2 5 3 7
> >
> >
> > my question is:
> >
> > how do i create a variable called margin_of_victory = votes
> for 1st place
> > -
> > votes for 2nd place?, i.e. 21-10 for state 1, 22 - 11 for
> state 2, 13 - 12
> > for state 3, 4 - 3 for state 4, etc.
>
> As a starting point, try using Nick Cox's -majority- routine,
> downloadable
> by SSC for just this purpose (-findit majority-). An example:
>
> . majority votesD votesA, pos(votesD) neg(votesA) by(state) [percent]
> generate(combo1)
>
> I say "starting point", because -majority- can only handle
> two parties at
> once: and even then in a particular combination.
>
*
* 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/