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

st: RE: RE: Sorting Data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Sorting Data
Date   Wed, 13 Nov 2002 18:22:36 -0000

Ray, Bryan
>
> Just a quick comment on the analysis of these data...It
> looks like a vote
> can be either yes, no, or abstain. I am no expert on UN
> voting patterns and
> the like, but I just thought that there might be some
> significance to the
> abstentions that you might lose by simply looking at, for a
> given vote,
> votes that match the U.S.'s vote.
>
> Maybe you have already thought about a way to deal with this or have
> determined that it is not an issue, but I thought it
> worthwhile to raise.

Good thought. Irrespective of whether A.F. Mkenda wants
to follow this up, a way of implementing this may
be of interest:

Your scores may well differ, but I'll illustrate
with

label def vote 1 "N" 2 "A" 3 "Y"

We initialise a counter again:

gen howdiff = 0

Now loop over the variables:

forval i = 1 / 5 {
	encode vote`i', gen(Nvote`i') label(vote)
	replace howdiff = howdiff + abs(Nvote`i' - Nvote`i'[4])
}

Again, this wires the observation number
of the US (4 in what I had after a -sort-).

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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index