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

Re: st: RE: Re: Tactical looping


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Re: Tactical looping
Date   Mon, 26 Jan 2004 22:14:20 -0000 (GMT)

Michael Blasnik wrote:

> I think you could just insert :
>
> drop if pc==.
>
> right after the 1st reshape command, that way missing vote percents won't
> count as the highest.  Another approach would be to insert
>
> replace pc=0 if pc==.
>
> in the same spot, although this could conceivably declare a party in the
> top
> 3 if 0% is in the top 3 in any election.  Also, I just realized that the
> approach I showed will split ties randomly so if you have any ties, you
> may
> need to decide what to do about them.

It almost worked. When I dropped this into the code, thus:

reshape long @lag, i(id) j(party) string
drop if lag==.
bysort id (lag): gen byte rank=_N-_n+1
keep if rank<5
keep id party rank
reshape wide  party, i(id) j(rank)
sort id
save top4
use "C:\DATA\pool7901.dta"
sort id
merge id using top4
assert _merge==3

I got an error after the final command

. assert _merge==3
1 contradiction in 3457 observations
assertion is false
r(9);

Thinking this might be because I'm specifying 4 parties and not 3, I
changed this to -assert _merge==4-. But this produced:

. assert _merge==4
3457 contradiction in 3457 observations
assertion is false
r(9);

However, quickly sampling the orderings showed them to be correct (but I
can't be sure that all of them are). Thus, is this error message worth
worrying about?

CLIVE NICHOLAS        |t: 0(44)191 222 5969
Politics Building     |e: [email protected]
School of Geography,  |f: 0(44)870 126 2421
 Politics & Sociology |
University of         |
 Newcastle-upon-Tyne  |
Newcastle-upon-Tyne   |
NE1 7RU		      |
United Kingdom	      |http://www.ncl.ac.uk/geps
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index