Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Winning and losing


From   "Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Winning and losing
Date   Fri, 21 Nov 2003 03:22:42 -0000 (GMT)

Statapeeps,

Yeah, I know, I know. I'm being greedy!! But this problem may tickle your
fancy. :-)

In my very same dataset, I'm looking to dummy-code (0/1) which party won
the ith seat in the jth election. Since this is Blighty, there can only be
one winner per district, but since that n=3452, that's an awful lot of
outcomes to code manually! There are five outcome categories: conwin;
labwin; ldmwin; natwin; and othwin.

Now here's the rub: since it's plurality-rule, I need to tell Stata to
code, say, conwin=1 and labwin-othwin=0 if, say, for district X: conpc=35;
labpc=31; ldmpc=16; natpc=17; othpc=1. I've tried several generates, such
as:

-g conwin=0 if conpc > labpc & ldmpc & natpc & othpc-
-replace conwin=1 if conpc < labpc & ldmpc & natpc & othpc-,

but, although Stata did not return errors at *any* of my 'solutions', each
kept producing multiple, rather than unique, 1's for each case (or n).

Any ideas as to where I'm going wrong?

Yours,
CLIVE NICHOLAS,
Politics Building,
School of Geography, Politics and Sociology,
University of Newcastle-upon-Tyne,
Newcastle-upon-Tyne,
NE1 7RU,
United Kingdom.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index